def _norm_rgb2hsl(r, g, b):
    """Convert normalised RGB colours to HSL. This function assumes the input
    has been sanitised and does no validation on the input parameters.

    This calculation has been adapted from Wikipedia:
    https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB

    :param r: Red as normalised colour (0 .. 1.0)
    :param g: Green as normalised colour (0 .. 1.0)
    :param b: Blue as normalised colour (0 .. 1.0)
    :return: Tuple containing H, S, L values
    """
    V = X_max = max(r, g, b)
    X_min = min(r, g, b)
    C = X_max - X_min
    L = (X_max + X_min) / 2
    H = 0
    if C > 0:
        if V == r:
            H = 60.0 * (g - b) / C
        elif V == g:
            H = 120.0 + 60.0 * (b - r) / C
        elif V == b:
            H = 240.0 + 60.0 * (r - g) / C

    S = 0.0
    if 0.0 < L < 1.0:
        S = (V - L) / min(L, 1-L)

    return H % 360.0, S, L