def _Resize(self, image, transform):
    """Use PIL to resize the given image with the given transform.

    Args:
      image: PIL.Image.Image object to resize.
      transform: images_service_pb.Transform to use when resizing.

    Returns:
      PIL.Image.Image with transforms performed on it.

    Raises:
      BadRequestError if the resize data given is bad.
    """
    width = 0
    height = 0

    if transform.has_width():
      width = transform.width()
      if width < 0 or 4000 < width:
        raise apiproxy_errors.ApplicationError(
            images_service_pb.ImagesServiceError.BAD_TRANSFORM_DATA)

    if transform.has_height():
      height = transform.height()
      if height < 0 or 4000 < height:
        raise apiproxy_errors.ApplicationError(
            images_service_pb.ImagesServiceError.BAD_TRANSFORM_DATA)

    crop_to_fit = transform.crop_to_fit()
    allow_stretch = transform.allow_stretch()

    current_width, current_height = image.size
    new_width, new_height = self._CalculateNewDimensions(current_width,
                                                         current_height,
                                                         width,
                                                         height,
                                                         crop_to_fit,
                                                         allow_stretch)
    new_image = image.resize((new_width, new_height), Image.ANTIALIAS)
    if crop_to_fit and (width > new_width or new_height > height):

      left = int((new_width - width) * transform.crop_offset_x())
      top = int((new_height - height) * transform.crop_offset_y())
      right = left + width
      bottom = top + height
      new_image = new_image.crop((left, top, right, bottom))

    return new_image
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/images/images_stub.py/ImagesServiceStub._Resize/swapped operands of `>`