docs: def _ilsr(fun, params, max_iter, tol):
      """Iteratively refine LSR estimates until convergence.
  
      Raises
      ------
      RuntimeError
          If the algorithm does not converge after ``max_iter`` iterations.
      """
      converged = NormOfDifferenceTest(tol, order=1)
      for _ in range(max_iter):
          params = fun(initial_params=params)
          if converged(params):
              return params
      raise RuntimeError("Did not converge after {} iterations".format(max_iter))