def the(it):
    """If the given iterator produces just one unique value, return
    it.  Otherwise, raise ValueError."""

    first = True
    out = None
    for v in it:
        if first:
            out = v
            first = False
        else:
            if out != v:
                raise ValueError("More than one value")
    if first:
        raise ValueError("Empty sequence")
    return out