code: def get_cmap(name=None, lut=None):
      """
      Get a colormap instance, defaulting to rc values if *name* is None.
  
      Colormaps added with :func:`register_cmap` take precedence over
      built-in colormaps.
  
      If *name* is a :class:`matplotlib.colors.Colormap` instance, it will be
      returned.
  
      If *lut* is not None it must be an integer giving the number of
      entries desired in the lookup table, and *name* must be a standard
      mpl colormap name.
      """
      if name is None:
          name = mpl.rcParams["image.cmap"]
  
      if isinstance(name, colors.Colormap):
          return name
  
      if name in cmap_d:
          if lut is None:
              return cmap_d[name]
          else:
              return cmap_d[name]._resample(lut)
      else:
          raise ValueError(
              "Colormap %s is not recognized. Possible values are: %s"
              % (name, ", ".join(sorted(cmap_d)))
          )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import numpy
  from numpy import ma
  import matplotlib
  import matplotlib.colors
  import matplotlib.cbook
  from matplotlib._cm import datad
  from matplotlib._cm_listed import cmaps
label_desc: Use image node_id 6 for calling a global function with example usage: get_cmap(name, lut) and returns: name, cmap_d, cmap_d