code: async def guessImageMetadataFromHttpData(response):
      
      metadata = None
      img_data = bytearray()
  
      while len(img_data) < CoverSourceResult.MAX_FILE_METADATA_PEEK_SIZE:
        new_img_data = await response.content.read(__class__.METADATA_PEEK_SIZE_INCREMENT)
        if not new_img_data:
          break
        img_data.extend(new_img_data)
  
        metadata = __class__.guessImageMetadataFromData(img_data)
        if (metadata is not None) and all(metadata):
          return metadata
  
      return metadata
docs: Identify an image format and size from the beginning of its HTTP data.