def first(iter):
    """Helper function that takes an iterable and returns the
    first element. No big deal, but it makes the code readable
    in some cases. It is typically useful when `iter` is (or 
    can be) a generator expression as you can use the indexing
    operator for ordinary lists and tuples."""
    for item in iter:
        return item
    raise ValueError("iterable is empty")