code: def _resize_if_too_large(image, max_shape):
      width_f = image.width / max_shape[1]
      height_f = image.height / max_shape[0]
      f = max(width_f, height_f)
      if f > 1.0:
          width, height = int(image.width / f), int(image.height / f)
      else:
          width, height = image.width, image.height
  
      # make sure we exactly abide by the max_shape, so that a rounding error did
      # not occur
      width = min(width, max_shape[1])
      height = min(height, max_shape[0])
  
      # Decode image and make sure it has 3 channels
      return _tc.image_analysis.resize(
          image, width, height, 3, decode=True, resample="bilinear"
      )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
label_desc: Use image node_id 1 for calling a global function with example usage: _resize_if_too_large(image, max_shape) and returns: _tc