def ginga_to_matplotlib_cmap(cm, name=None):
    """Convert Ginga colormap to matplotlib's."""
    if name is None:
        name = cm.name
    from matplotlib.colors import ListedColormap
    carr = np.asarray(cm.clst)
    mpl_cm = ListedColormap(carr, name=name, N=len(carr))
    return mpl_cm