def hsla_to_rgba(h, s, l, a):
    """ 0 <= H < 360, 0 <= s,l,a < 1
    """
    h = h % 360
    s = max(0, min(1, s))
    l = max(0, min(1, l))
    a = max(0, min(1, a))
    c = (1 - abs(2 * l - 1)) * s
    x = c * (1 - abs(h / 60 % 2 - 1))
    m = l - c / 2
    if h < 60:
        r, g, b = c, x, 0
    elif h < 120:
        r, g, b = x, c, 0
    elif h < 180:
        r, g, b = 0, c, x
    elif h < 240:
        r, g, b = 0, x, c
    elif h < 300:
        r, g, b = x, 0, c
    else:
        r, g, b = c, 0, x
    return int((r + m) * 255), int((g + m) * 255), int((b + m) * 255), int(
        a * 255)
