code: def resize_image(image, max_scale, max_size):
      """Obtain the optimal resized image subject to a maximum scale
      and maximum size.
  
      Args:
          image: The input image
          max_scale: The maximum scale to apply
          max_size: The maximum size to return
      """
      if max(image.shape) * max_scale > max_size:
          # We are constrained by the maximum size
          scale = max_size / max(image.shape)
      else:
          # We are contrained by scale
          scale = max_scale
      return (
          cv2.resize(
              image,
              dsize=(
                  int(image.shape[1] * scale),
                  int(image.shape[0] * scale),
              ),
          ),
          scale,
      )
  
imports: import os
  import io
  import typing
  import hashlib
  import urllib.request
  import urllib.parse
  import cv2
  import imgaug
  import numpy
  import validators
  import typing_extensions
  import matplotlib.pyplot
  from shapely import geometry
  from scipy import spatial
label_desc: Use image node_id 11 for calling a global function with example usage: resize_image(image, max_scale, max_size) and returns: cv2,  scale