import itertools


def n_steps_iterator(n):
    """Returns a generator function that yields n steps."""

    def n_steps_iterator_(steps):
        yield from itertools.islice(steps, n)

    return n_steps_iterator_