Generate (item, islast) pairs for an iterable.

    Generates pairs where the first element is an item from the iterable
    source and the second element is a boolean flag indicating if it is
    the last item in the sequence.

def iter_islast(iterable):
    """Generate (item, islast) pairs for an iterable.

    Generates pairs where the first element is an item from the iterable
    source and the second element is a boolean flag indicating if it is
    the last item in the sequence.
    """
    it = iter(iterable)
    prev = next(it)
    for item in it:
        yield prev, False
        prev = item
    yield prev, True