<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def normalize(color):
 """ Returns an hex color Parameters: color : string Color representation in rgba|rgb|hex Example: normalize('#f03') """

    if type(color) == tuple:
        color = to_rgba(*color)
    if 'rgba' in color:
        return rgb_to_hex(rgba_to_rgb(color))
    elif 'rgb' in color:
        return rgb_to_hex(color)
    elif '#' in color:
        if len(color) == 7:
            return color
        else:
            color = color[1:]
            return '#' + ''.join([x * 2 for x in list(color)])
    else:
        try:
            return normalize(cnames[color.lower()])
        except:
            raise CufflinksError('Not a valid color: ' + color)