def window(seq, n=<NUM_LIT:2>):
it = iter(seq)<EOL>result = tuple(islice(it, n))<EOL>if len(result) == n:<EOL><INDENT>yield result<EOL><DEDENT>for token in it:<EOL><INDENT>result = result[<NUM_LIT:1>:] + (token,)<EOL>yield result<EOL><DEDENT>
Yield a sliding window over an iterable.

Args:
    seq (iter): The sequence.
    n (int): The window width.

Yields:
    tuple: The next window.