def single_element(s, or_else=...):
    """Get the element out of a set of cardinality 1"""

    if len(s) == 0:
        if or_else is not ...:
            return or_else
        raise ValueError("Set is empty.")


    if len(s) > 1:
        set_string = "    " + "\n    ".join(map(repr, s))
        raise ValueError("Set contains more than one element."
                         f"Cannot select successor unambiguously from: \n"
                         f"{set_string}")

    for q in s:
        return q