code: def write_scaled_png(
      data: np.array, filename: PathLike
  ) -> Dict[str, float]:
      """Scales data to [0, 1] and then saves as png and returns the scale.
  
      Args:
        data: the image (H, W, C) to be written (has to be float32 or float64).
        filename: the filename to write to (can be a GCS path).
  
      Returns:
        {"min": min_value, "max": max_value}
      """
      assert data.dtype in [np.float32, np.float64], data.dtype
      min_value = np.min(data)
      max_value = np.max(data)
      scaling = {"min": min_value.item(), "max": max_value.item()}
      data = (data - min_value) * 65535 / (max_value - min_value)
      data = data.astype(np.uint16)
      write_png(data, filename)
      return scaling
  
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 8 for calling a global function with example usage: write_scaled_png(data, filename) and returns: scaling