from matplotlib.colors import ListedColormap

cm3 = ListedColormap(['#0000aa', '#ff2020', '#50ff50'])
cm2 = ListedColormap(['#0000aa', '#ff2020'])

[(3, 'matplotlib.colors.ListedColormap', 'ListedColormap', False, 'from matplotlib.colors import ListedColormap\n'), (4, 'matplotlib.colors.ListedColormap', 'ListedColormap', False, 'from matplotlib.colors import ListedColormap\n')]