code: def read_png(filename: PathLike, 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 contextlib
  import functools
  import logging
  import json
  import multiprocessing
  import pickle
  from typing import Any, Dict
  from etils import epath
  import imageio
  import numpy
  import png
  import tensorflow
  from kubric import plotting
  from kubric.kubric_typing import PathLike
label_desc: Use image node_id 9 for calling a global function with example usage: read_png(filename, rescale_range) and returns: pngdata