code: def to_ds_image(binned, rgba):
      if binned.ndim == 2:
          return tf.Image(
              uint8_to_uint32(rgba),
              coords=binned.coords,
              dims=binned.dims,
          )
      elif binned.ndim == 3:
          return tf.Image(
              uint8_to_uint32(rgba),
              dims=binned.dims[:-1],
              coords=dict(
                  [
                      (binned.dims[1], binned.coords[binned.dims[1]]),
                      (binned.dims[0], binned.coords[binned.dims[0]]),
                  ]
              ),
          )
      else:
          raise ValueError("Aggregate must be 2D or 3D.")
  
imports: import warnings
  from matplotlib.image import _ImageBase
  from matplotlib.patches import Patch
  from matplotlib.transforms import Bbox, TransformedBbox, BboxTransform
  import matplotlib
  import numpy
  from .None import reductions
  from .None import transfer_functions
  from .colors import Sets1to3
  from .core import bypixel, Canvas
label_desc: Use image node_id 3 for calling a global function with example usage: to_ds_image(binned, rgba) and returns: tf, tf