Convert HSV (hue, saturation, value) to RGB.

def hsv(h, s, v):
    """Convert HSV (hue, saturation, value) to RGB."""
    if 360 < h < 0:
        raise ValueError("h out of range: {}".format(h))
    if 1 < s < 0:
        raise ValueError("s out of range: {}".format(h))
    if 1 < v < 0:
        raise ValueError("v out of range: {}".format(h))
    c = v * s  # chroma
    h1 = h / 60
    x = c * (1 - abs(h1 % 2 - 1))
    if 0 <= h1 < 1:
        r1, g1, b1 = (c, x, 0)
    elif 1 <= h1 < 2:
        r1, g1, b1 = (x, c, 0)
    elif 2 <= h1 < 3:
        r1, g1, b1 = (0, c, x)
    elif 3 <= h1 < 4:
        r1, g1, b1 = (0, x, c)
    elif 4 <= h1 < 5:
        r1, g1, b1 = (x, 0, c)
    elif 5 <= h1 < 6:
        r1, g1, b1 = (c, 0, x)
    m = v - c
    r, g, b = r1 + m, g1 + m, b1 + m
    return int(r * 255), int(g * 255), int(b * 255)