code: def _get_cmap(name=None, lut=None):
      """
      Get a colormap instance, defaulting to rc values if *name* is None.
  
      Parameters
      ----------
      name : `~matplotlib.colors.Colormap` or str or None, default: None
          If a `.Colormap` instance, it will be returned. Otherwise, the name of
          a colormap known to Matplotlib, which will be resampled by *lut*. The
          default, None, means :rc:`image.cmap`.
      lut : int or None, default: None
          If *name* is not already a Colormap instance and *lut* is not None, the
          colormap will be resampled to have *lut* entries in the lookup table.
  
      Returns
      -------
      Colormap
      """
      if name is None:
          name = mpl.rcParams["image.cmap"]
      if isinstance(name, colors.Colormap):
          return name
      _api.check_in_list(sorted(_colormaps), name=name)
      if lut is None:
          return _colormaps[name]
      else:
          return _colormaps[name].resampled(lut)
  
imports: from collections.abc import Mapping
  import functools
  import numpy
  from numpy import ma
  import matplotlib
  from matplotlib import _api, colors, cbook, scale
  from matplotlib._cm import datad
  from matplotlib._cm_listed import cmaps
label_desc: Use image node_id 3 for calling a global function with example usage: _get_cmap(name, lut) and returns: name, _colormaps, _colormaps