def modulo_n_iterations(n):
    """Return a stop criterion that stops at each `n`-th iteration.

    This is useful if one wants a regular pause in optimization, e.g. to save
    data to disk or give feedback to the user.

    Parameters
    ----------

    n : int
      Number of iterations to perform between pauses.


    Returns
    -------

    f : function
      Stopping criterion function.


    Examples
    --------

    >>> S.modulo_n_iterations(10)({'n_iter': 9})
    False
    >>> S.modulo_n_iterations(10)({'n_iter': 10})
    True
    >>> S.modulo_n_iterations(10)({'n_iter': 11})
    False
    """
    def inner(info):
        return info['n_iter'] % n == 0
    return inner