code: def _generate_cmap(name, lutsize):
      """Generates the requested cmap from its *name*.  The lut size is
      *lutsize*."""
  
      spec = datad[name]
  
      # Generate the colormap object.
      if "red" in spec:
          return colors.LinearSegmentedColormap(name, spec, lutsize)
      elif "listed" in spec:
          return colors.ListedColormap(spec["listed"], name)
      else:
          return colors.LinearSegmentedColormap.from_list(
              name, spec, lutsize
          )
  
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 4 for calling a global function with example usage: _generate_cmap(name, lutsize) and returns: colors, colors, colors