def repeater(iter, n):
    """Return an iterator that repeats each element of `iter` exactly
    `n` times before moving on to the next element.

    Examples
    --------

    >>> from climin.schedule import repeater
    >>> s = repeater([1, 2, 3], 2)
    >>> [next(s) for i in range(6)]
    [1, 1, 2, 2, 3, 3]
    """
    for i in iter:
        for j in range(n):
            yield i
