def as_bool(string: str) -> bool:
    """Convert string to bool.

    Only the values "1", "true", "0", and "false" are accepted.

    """
    string = string.lower()
    if string in ("1", "true"):
        return True
    if string in ("0", "false"):
        return False
    raise ValueError('Expected value to be one of "1", "true", "0", or "false"')