def _hex_to_bgr(color):
    """Convert hex color to BGR"""

    # Check for the right format of hex value
    if len(color) != 6:
        raise ValueError("Hex color value {} invalid".format(color))

    # Convert to BGR
    try:
        return tuple(int(color[i : i + 2], 16) for i in (4, 2, 0))
    except ValueError:
        raise ValueError("Hex color value {} invalid".format(color))