code: def cmapper(
      vmin: float,
      vmax: float,
      cmap: str = "PuBu",
      clip: bool = True,
      as_hex: bool = True,
  ) -> Callable:
      norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax, clip=clip)
      mapper = mpl.cm.ScalarMappable(norm=norm, cmap=cmap)
      if as_hex:
          return lambda value: rgb2hex(mapper.to_rgba(value))
      return lambda value: mapper.to_rgba(value, bytes=True)
  
imports: from typing import List, Callable
  import matplotlib
  import matplotlib.pyplot
  from matplotlib.colors import rgb2hex
label_desc: Use image node_id 2 for calling a global function with example usage: cmapper(vmin, vmax, cmap, clip, as_hex) and returns: function, function