def _hsl2rgb(hsl):
    """Create an RGB integer from a HSL tuple"""
    def _hue(p, q, t):
        if t < 0:
            t += 1
        elif t > 1:
            t -= 1
        if t < (1.0 / 6.0):
            return p + ((q - p) * 6.0 * t)
        elif t < 0.5:
            return q
        elif t < (2.0 / 3.0):
            return p + ((q - p) * ((2.0 / 3.0) - t) * 6.0)
        else:
            return p
    h = hsl[0]
    s = hsl[1]
    l = hsl[2]
    if s == 0:
        # grayscale
        r = l
        g = l
        b = l
    else:
        if l < 0.5:
            q = l * (1 + s)
        else:
            q = l + s - (l * s)
        p = (2 * l) - q
        r = _hue(p, q, h + (1.0 / 3.0))
        g = _hue(p, q, h)
        b = _hue(p, q, h - (1.0 / 3.0))
    rgb = (int(round(r * 255)) << 16) | (int(round(g * 255)) << 8) | int(round(b * 255))
    return rgb