def with_last(it):
    """
    Wrap an iterable yielding an `is_last, value`.

    >>> list(with_last([]))
    []
    >>> list(with_last([1]))
    [(True, 1)]
    >>> list(with_last([1, 2]))
    [(False, 1), (True, 2)]
    >>> list(with_last([1, 2, 3]))
    [(False, 1), (False, 2), (True, 3)]
    """
    it = iter(it)
    try:
        prev_value = next(it)
    except StopIteration:
        return
    value = prev_value
    for value in it:
        yield False, prev_value
        prev_value = value
    yield True, value
