'Make a colormap from a list of colors.
*colors*
a list of matplotlib color specifications,
or an equivalent Nx3 or Nx4 floating point array
(*N* rgb or rgba values)
*name*
a string to identify the colormap
*N*
the number of entries in the map.  The default is *None*,
in which case there is one colormap entry for each
element in the list of colors.  If::
N < len(colors)
the list will be truncated at *N*.  If::
N > len(colors)
the list will be extended by repetition.'

def __init__(self, colors, name=u'from_list', N=None):

    self.colors = colors
    self.monochrome = False
    if (N is None):
        N = len(self.colors)
    elif isinstance(self.colors, six.string_types):
        self.colors = ([self.colors] * N)
        self.monochrome = True
    elif cbook.iterable(self.colors):
        self.colors = list(self.colors)
        if (len(self.colors) == 1):
            self.monochrome = True
        if (len(self.colors) < N):
            self.colors = (list(self.colors) * N)
        del self.colors[N:]
    else:
        try:
            gray = float(self.colors)
        except TypeError:
            pass
        else:
            self.colors = ([gray] * N)
        self.monochrome = True
    Colormap.__init__(self, name, N)
