code: def _CheckStorageMetadata(cls, metadata_values, check_readable_only=False):
      
      format_version = metadata_values.get('format_version', None)
  
      if not format_version:
        raise IOError('Missing format version.')
  
      try:
        format_version = int(format_version, 10)
      except (TypeError, ValueError):
        raise IOError('Invalid format version: {0!s}.'.format(format_version))
  
      if not check_readable_only and format_version != cls._FORMAT_VERSION:
        raise IOError('Format version: {0:d} is not supported.'.format(
            format_version))
  
      if format_version < cls._COMPATIBLE_FORMAT_VERSION:
        raise IOError(
            'Format version: {0:d} is too old and no longer supported.'.format(
                format_version))
  
      if format_version > cls._FORMAT_VERSION:
        raise IOError(
            'Format version: {0:d} is too new and not yet supported.'.format(
                format_version))
  
      metadata_values['format_version'] = format_version
  
      compression_format = metadata_values.get('compression_format', None)
      if compression_format not in definitions.COMPRESSION_FORMATS:
        raise IOError('Unsupported compression format: {0:s}'.format(
            compression_format))
  
      serialization_format = metadata_values.get('serialization_format', None)
      if serialization_format != definitions.SERIALIZER_FORMAT_JSON:
        raise IOError('Unsupported serialization format: {0:s}'.format(
            serialization_format))
  
      storage_type = metadata_values.get('storage_type', None)
      if storage_type not in definitions.STORAGE_TYPES:
        raise IOError('Unsupported storage type: {0:s}'.format(
            storage_type))
docs: Checks the storage metadata.
  
      Args:
        metadata_values (dict[str, str]): metadata values per key.
        check_readable_only (Optional[bool]): whether the store should only be
            checked to see if it can be read. If False, the store will be checked
            to see if it can be read and written to.
  
      Raises:
        IOError: if the format version or the serializer format is not supported.
        OSError: if the format version or the serializer format is not supported.