import itertools


def peek(iterator):
    """
        Peek at next item from iterator.

        >>> item, iterator = peek(iter(range(3)))
        >>> assert item == 0
        >>> assert list(iterator) == [0, 1, 2]
    """
    item = next(iterator)
    return item, itertools.chain([item], iterator)