code: def array_to_png(
      arr,
      path=None,
      show=True,
      vmin=None,
      vmax=None,
      scale=None,
      labels=None,
  ):
      """Save an array as a PNG image with PIL and show it.
  
      Args:
        arr: numpy array. Should be 2-dimensional or 3-dimensional where the third
          dimension has 3 channels.
        path: str. Path for the image output. Default is /tmp/tmp.png for quickly
          showing the image in a notebook.
        show: bool. Whether to show the image using IPython utilities, only works in
          notebooks.
        vmin: number. Minimum data value, which will correspond to black in
          greyscale or lack of each color in RGB images. Default None takes the
          minimum of the data from arr.
        vmax: number. Maximum data value, which will correspond to white in
          greyscale or full presence of each color in RGB images. Default None takes
          the max of the data from arr.
        scale: integer. Number of pixels wide and tall to show each cell in the
          array. This sizes up the image while keeping exactly the same number of
          pixels for every cell in the array, preserving resolution and preventing
          any interpolation or overlapping of pixels. Default None adapts to the
          size of the image to multiply it up until a limit of 500 pixels, a
          convenient size for use in notebooks. If saving to a file for automated
          processing, scale=1 is recommended to keep output files small and simple
          while still retaining all the information content.
        labels: list of str. Labels to show across the top of the image.
  
      Returns:
        None. Saves an image at path and optionally shows it with IPython.display.
      """
      scaled, image_mode = autoscale_colors_for_png(
          arr, vmin=vmin, vmax=vmax
      )
      save_to_png(
          scaled,
          path=path,
          show=show,
          image_mode=image_mode,
          labels=labels,
          scale=scale,
      )
  
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 10 for calling a global function with example usage: array_to_png(arr, path, show, vmin, vmax, scale, labels) without return types