def val_to_boolean(val):
    """
    Convert any value to boolean

    Boolean: return as-is

    - Integer: 1 = True, 0 = False
    - Strings (case-insensitive): '1', 'true', 't', 'yes', 'on', 'y' = True
    - '0', 'false', 'f', 'no', 'off', 'n' = False

    Args:
        val: value to convert

    Returns:
        boolean converted value, None if val is None

    Raises:
        ValueError: if value can not be converted
    """
    if val is None:
        return None
    elif isinstance(val, bool):
        return val
    else:
        val = str(val)
        if val.lower() in ['1', 't', 'true', 'yes', 'on', 'y']:
            return True
        elif val.lower() in ['0', 'f', 'false', 'no', 'off', 'n']:
            return False
        else:
            raise ValueError