<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_cmap(name, lut=None):
 """ Returns the specified colormap. Parameters name: str or :class:`matplotlib.colors.Colormap` If a colormap, it returned unchanged. %(cmap_note)s lut: int An integer giving the number of entries desired in the lookup table Returns ------- matplotlib.colors.Colormap The colormap specified by `name` See Also -------- show_colormaps: A function to display all available colormaps Notes ----- Different from the :func::`matpltolib.pyplot.get_cmap` function, this function changes the number of colors if `name` is a :class:`matplotlib.colors.Colormap` instance to match the given `lut`."""

    if name in rcParams['colors.cmaps']:
        colors = rcParams['colors.cmaps'][name]
        lut = lut or len(colors)
        return FixedColorMap.from_list(name=name, colors=colors, N=lut)
    elif name in _cmapnames:
        colors = _cmapnames[name]
        lut = lut or len(colors)
        return FixedColorMap.from_list(name=name, colors=colors, N=lut)
    else:
        cmap = mpl_get_cmap(name)
        # Note: we could include the `lut` in the call of mpl_get_cmap, but
        # this raises a ValueError for colormaps like 'viridis' in mpl version
        # 1.5. Besides the mpl_get_cmap function does not modify the lut if
        # it does not match
        if lut is not None and cmap.N != lut:
            cmap = FixedColorMap.from_list(
                name=cmap.name, colors=cmap(np.linspace(0, 1, lut)), N=lut)
        return cmap