code: def func_max_size(
      height: int,
      width: int,
      max_size: int,
      func: Callable[[int, int], int],
  ) -> Tuple[int, int]:
      """
      Calculate rescaled height and width of the image in question wrt to a specific size.
  
      Parameters
      ----------
      height: height of the image in question.
      width: width of the image in question.
      max_size: size wrt the image needs to be rescaled (resized).
      func: min/max. Whether to compare max_size to the smallest/longest of the image dims.
  
      Returns
      -------
      Rescaled height and width
      """
      scale = max_size / float(func(width, height))
  
      if scale != 1.0:
          height, width = tuple(
              py3round(dim * scale) for dim in (height, width)
          )
      return height, width
  
file_path: icevision/icevision/tfms/albumentations/albumentations_helpers.py
imports: import albumentations
  from icevision.imports import *
  from icevision.core import *
  from icevision.utils.imageio import ImgSize
label_desc: Use image node_id 6 for calling a global function with example usage: func_max_size(height, width, max_size, func) and returns: height,  width