docs: def set(clear=False, **defaults):
          """ Set default parameters for :class:`lsqfit.nonlinear_fit`.
  
          Use to set default values for parameters: ``svdcut``,
          ``debug``, ``tol``, ``maxit``, and ``fitter``. Can also set
          parameters specific to the fitter specified by the ``fitter``
          argument.
  
          Sample usage::
  
              import lsqfit
  
              old_defaults = lsqfit.nonlinear_fit.set(
                  fitter='gsl_multifit', alg='subspace2D', solver='cholesky',
                  tol=1e-10, debug=True,
                  )
  
          ``nonlinear_fit.set()`` without arguments returns a
          dictionary containing the current defaults.
  
          Args:
              clear (bool): If ``True`` remove earlier settings,
                  restoring the original defaults, before adding new
                  defaults. The default value is ``clear=False``.
                  ``nonlinear_fit.set(clear=True)`` restores the
                  original defaults.
              defaults (dict): Dictionary containing new defaults.
  
          Returns:
              A dictionary containing the old defaults,
              before they were updated. These can be restored using
              ``nonlinear_fit.set(old_defaults)`` where ``old_defaults``
              is the dictionary containint the old defaults.
          """
          old_defaults = dict(nonlinear_fit.DEFAULTS)
          if clear:
              nonlinear_fit.DEFAULTS = {}
          for k in defaults:
              if k == 'fitter' and defaults[k] not in nonlinear_fit.FITTERS:
                  raise ValueError('unknown fitter: ' + str(defaults[k]))
              nonlinear_fit.DEFAULTS[k] = defaults[k]
          return old_defaults