def zero_or_one_to_boolean(s):
    """Convert 1 or 0 string to boolean."""
    if isinstance(s, str):
        if s == "1":
            return True
        if s == "0":
            return False
    if isinstance(s, bool):
        return s

    raise ValueError("Cannot covert {} to a boolean".format(s))