def flatten(iter_of_iters):
    """
    Flatten an iterator of iterators into a single, long iterator, exhausting
    each subiterator in turn.

    >>> flatten([[1, 2], [3, 4]])
    [1, 2, 3, 4]

    """
    retval = []
    for val in iter_of_iters:
        retval.extend(val)
    return retval