code: def scale_colors_for_png(arr, vmin=0, vmax=255):
      """Scale an array to integers between 0 and 255 to prep it for a PNG image.
  
      Args:
        arr: numpy array. Input array made up of integers or floats.
        vmin: number. Minimum data value to map to 0. Values below this will be
          clamped to this value and therefore become 0.
        vmax: number. Maximum data value to map to 255. Values above this will be
          clamped to this value and therefore become 255.
  
      Returns:
        numpy array of dtype np.uint8 (integers between 0 and 255).
      """
      if vmax == 0 or vmax <= vmin:
          raise ValueError(
              "vmin must be non-zero and higher than vmin."
          )
  
      # Careful not to modify the original array
      scaled = np.copy(arr)
  
      # Snap numbers in the array falling outside the range into the range,
      # otherwise they will produce artifacts due to byte overflow
      scaled[scaled > vmax] = vmax
      scaled[scaled < vmin] = vmin
  
      # Scale the input into the range of vmin to vmax
      if vmin != 0 or vmax != 255:
          scaled = ((scaled - vmin) / (vmax - vmin)) * 255
      return scaled.astype(np.uint8)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import enum
  import math
  from typing import List, NamedTuple, Tuple
  from etils import epath
  from IPython import display
  import numpy
  from PIL import Image
  from PIL import ImageDraw
  from third_party.nucleus.protos import variants_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: scale_colors_for_png(arr, vmin, vmax) and returns: scaled