docs: def resize(image, width=None, height=None, crop=False):
      """
      Resize an image and return the resized file.
      """
      # First normalize params to determine which file to get
      width, height, crop = _normalize_params(image, width, height, crop)
  
      try:
          # Check the image file state for clean close
          is_closed = image.closed
  
          if is_closed:
              image.open()
  
          # Create the resized file
          # Do resize and crop
          resized_image = _resize(image, width, height, crop)
      finally:
          # Re-close if received a closed file
          if is_closed:
              image.close()
  
      return ImageFile(resized_image)