def METHOD_NAME(iterable, n):
    assert n > 0
    it = iter(iterable)
    state = deque(islice(it, 0, n - 1), maxlen=n)
    for new_element in it:
        state.append(new_element)
        yield tuple(state)
        state.popleft()