import math


def _hsv2rgb(hue, sat, value):
    """Create an RGB integer from HSV"""
    # achromatic (grey)
    r = value
    g = value
    b = value
    if sat != 0:
        h = hue / 60
        i = math.floor(h)
        f = h - i
        p = value * (1.0 - sat)
        q = value * (1.0 - (sat * f))
        t = value * (1.0 - (sat * (1.0 - f)))
        if i == 0:
            r = value
            g = t
            b = p
        elif i == 1:
            r = q
            g = value
            b = p
        elif i == 2:
            r = p
            g = value
            b = t
        elif i == 3:
            r = p
            g = q
            b = value
        elif i == 4:
            r = t
            g = p
            b = value
        else:
            r = value
            g = p
            b = q
    red = int(round(r * 255))
    green = int(round(g * 255))
    blue = int(round(b * 255))
    rgb = (red << 16) | (green << 8) | blue
    return rgb