def hex_to_rgb(hex_code):
    """
    Converts hex to rgb colours
    ===========================

    Parameters:
    -----------
    hex: 6 characters representing a hex colour (str)

    Returns:
    --------
    rgb: RGB values (list of 3 floats)
    """
    hex_code = hex_code.strip("#")  # removes hash symbol if present
    lv = len(hex_code)
    rgb = tuple(int(hex_code[i : i + lv // 3], 16) for i in range(0, lv, lv // 3))
    return rgb