def _OpenImageData(self, image_data):
    """Open image data from ImageData protocol buffer.

    Args:
      image_data: ImageData protocol buffer containing image data or blob
        reference.

    Returns:
      Image containing the image data passed in or reference by blob-key.

    Raises:
      ApplicationError if both content and blob-key are provided.
      NOTE: 'content' must always be set because it is a required field,
      however, it must be the empty string when a blob-key is provided.
    """
    if image_data.content() and image_data.has_blob_key():
      raise apiproxy_errors.ApplicationError(
          images_service_pb.ImagesServiceError.INVALID_BLOB_KEY)

    if image_data.has_blob_key():
      image = self._OpenBlob(image_data.blob_key())
    else:
      image = self._OpenImage(image_data.content())


    img_format = image.format
    if ("BMP", "GIF", "ICO", "JPEG", "PNG", "TIFF", "WEBP") not in img_format:
      raise apiproxy_errors.ApplicationError(
          images_service_pb.ImagesServiceError.NOT_IMAGE)
    return image
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/images/images_stub.py/ImagesServiceStub._OpenImageData/swapped operands of `not in`