def hex_to_rgb(hex):
    """
    Convert a hex colour to(r, g, b).

    Arguments:
    hex: Hexidecimal colour code, i.e. '#abc123'.

    Returns: (r, g, b) tuple with values 0 - 1000.
    """

    scalar = 3.9215  # 255 * 3.9215 ~= 1000.
    r = int(int(hex[1:3], 16) * scalar)
    g = int(int(hex[3:5], 16) * scalar)
    b = int(int(hex[5:7], 16) * scalar)

    return (r, g, b)