<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def color_table(color, N=1, sort=False, sort_values=False, inline=False, as_html=False):
 """ Generates a colour table Parameters: color : string | list | dict Color representation in rgba|rgb|hex If a list of colors is passed then these are displayed in a table N : int number of colours to generate When color is not a list then it generaes a range of N colors sort : bool if True then items are sorted sort_values : bool if True then items are sorted by color values. Only applies if color is a dictionary inline : bool if True it returns single line color blocks as_html : bool if True it returns the HTML code Example: color_table('#ff9933') color_table(cufflinks.cnames) color_table(['pink','salmon','yellow']) Note: This function only works in iPython Notebook """

    if isinstance(color, list):
        c_ = ''
        rgb_tup = [normalize(c) for c in color]
        if sort:
            rgb_tup.sort()
    elif isinstance(color, dict):
        c_ = ''
        items = [(k, normalize(v), hex_to_hsv(normalize(v)))
                 for k, v in list(color.items())]
        if sort_values:
            items = sorted(items, key=operator.itemgetter(2))
        elif sort:
            items = sorted(items, key=operator.itemgetter(0))
        rgb_tup = [(k, v) for k, v, _ in items]
    else:
        c_ = normalize(color)
        if N > 1:
            rgb_tup = np.array(color_range(c_, N))[::-1]
        else:
            rgb_tup = [c_]

    def _color(c):
        if hex_to_hsv(c)[2] < .5:
            color = "#ffffff"
            shadow = '0 1px 0 #000'
        else:
            color = "#000000"
            shadow = '0 1px 0 rgba(255,255,255,0.6)'
        if c == c_:
            border = " border: 1px solid #ffffff;"
        else:
            border = ''
        return color, shadow, border

    s = '<ul style="list-style-type: none;">' if not inline else ''
    for c in rgb_tup:
        if isinstance(c, tuple):
            k, c = c
            k += ' : '
        else:
            k = ''
        if inline:
            s += '<div style="background-color:{0};height:20px;width:20px;display:inline-block;"></div>'.format(
                c)
        else:
            color, shadow, border = _color(c)
            s += """<li style="text-align:center;""" + border + """line-height:30px;background-color:""" + c + """;"> 
            <span style=" text-shadow:""" + shadow + """; color:""" + color + """;">""" + k + c.upper() + """</span>
            </li>"""
    s += '</ul>' if not inline else ''
    if as_html:
        return s
    return display(HTML(s))