code: def update_image_size_range(spec, feature_name, size_range):
      """
      Annotate an input or output Image feature in a Neural Network spec to
      to accommodate a range of image sizes
  
      :param spec: MLModel
          The MLModel spec containing the feature
  
      :param feature_name: str
          The name of the Image feature for which to add shape information.
          If the feature is not found in the input or output descriptions then
          an exception is thrown
  
      :param size_range: NeuralNetworkImageSizeRange
          A NeuralNetworkImageSizeRange object with the populated image size
          range information.
  
      Examples
      --------
      .. sourcecode:: python
  
          >>> import coremltools
          >>> from coremltools.models.neural_network import flexible_shape_utils
          >>> spec = coremltools.utils.load_spec('mymodel.mlmodel')
          >>> img_size_ranges = flexible_shape_utils.NeuralNetworkImageSizeRange()
          >>> img_size_ranges.add_height_range(64, 128)
          >>> img_size_ranges.add_width_range(128, -1)
          >>> flexible_shape_utils.update_image_size_range(spec, feature_name='my_multiarray_featurename', size_range=img_size_ranges)
  
      :return:
          None. The spec object is updated
      """
      if not isinstance(size_range, NeuralNetworkImageSizeRange):
          raise Exception(
              "Shape ranges should be of type NeuralNetworkImageSizeRange"
          )
  
      feature = _get_feature(spec, feature_name)
      if feature.type.WhichOneof("Type") != "imageType":
          raise Exception(
              "Trying to add size ranges for "
              "a non-image feature type"
          )
  
      feature.type.imageType.ClearField("SizeFlexibility")
      feature.type.imageType.imageSizeRange.heightRange.lowerBound = (
          size_range.get_height_range().lowerBound
      )
      feature.type.imageType.imageSizeRange.heightRange.upperBound = (
          size_range.get_height_range().upperBound
      )
  
      feature.type.imageType.imageSizeRange.widthRange.lowerBound = (
          size_range.get_width_range().lowerBound
      )
      feature.type.imageType.imageSizeRange.widthRange.upperBound = (
          size_range.get_width_range().upperBound
      )
  
      # Bump up specification version
      spec.specificationVersion = max(
          _MINIMUM_FLEXIBLE_SHAPES_SPEC_VERSION,
          spec.specificationVersion,
      )
  
imports: from ..utils import _get_feature, _get_nn_layers, _get_input_names
  from ...None import _MINIMUM_FLEXIBLE_SHAPES_SPEC_VERSION
  from ...None import _MINIMUM_NDARRAY_SPEC_VERSION
label_desc: Use image node_id 3 for calling a global function with example usage: update_image_size_range(spec, feature_name, size_range) without return types