code: def read_png(filename, rescale_range=None) -> np.ndarray:
      filename = as_path(filename)
      png_reader = png.Reader(bytes=filename.read_bytes())
      width, height, pngdata, info = png_reader.read()
      del png_reader
  
      bitdepth = info["bitdepth"]
      if bitdepth == 8:
          dtype = np.uint8
      elif bitdepth == 16:
          dtype = np.uint16
      else:
          raise NotImplementedError(f"Unsupported bitdepth: {bitdepth}")
  
      plane_count = info["planes"]
      pngdata = np.vstack(list(map(dtype, pngdata)))
      if rescale_range is not None:
          minv, maxv = rescale_range
          pngdata = pngdata / 2**bitdepth * (maxv - minv) + minv
  
      return pngdata.reshape((height, width, plane_count))
  
imports: import dataclasses
  import json
  import logging
  import imageio
  import numpy
  import png
  import tensorflow
  import tensorflow_datasets.public_api
  from typing import List, Dict, Union
label_desc: Use image node_id 13 for calling a global function with example usage: read_png(filename, rescale_range) and returns: pngdata