Converts a color from HSV to a hex RGB.

    HSV should be in range 0..1, though hue wraps around. Output is a 
    hexadecimal color value as used by CSS, HTML and SVG

def to_rgb(hsv):
    """Converts a color from HSV to a hex RGB.

    HSV should be in range 0..1, though hue wraps around. Output is a 
    hexadecimal color value as used by CSS, HTML and SVG"""
    r, g, b = [int(min(255, max(0, component * 256)))
               for component in colorsys.hsv_to_rgb(*hsv)]

    return "%02x%02x%02x" % (r, g, b)