def to_bool(val):
    """Convert val to True or False.

    Converts 'true' (case-insensitive) and 1, '1', or True to True.
    Converts 'false', 'null' or 'none' (case-insensitive), the empty string '',
    and 0, '0', or False to False.
    Raises a ValueError for any other input.

    >>> to_bool('true')
    True
    >>> to_bool('False')
    False
    >>> to_bool(0)
    False
    >>> to_bool('0')
    False
    >>> to_bool(None)
    False
    >>> to_bool('yes')
    ValueError("Invalid boolean value 'yes'")
    """
    strval = str(val).lower()
    if strval in ('true', '1'):
        return True
    elif strval in ('false', '0', 'null', 'none', ''):
        return False
    else:
        raise ValueError(f'Invalid boolean value {val!r}')
