docs: def lsqfit(self, data=None, pdata=None, prior=None, p0=None, **kargs):
          """ Compute least-squares fit of models to data.
  
          :meth:`MultiFitter.lsqfit` fits all of the models together, in
          a single fit. It returns the |nonlinear_fit| object from the fit.
  
          To see plots of the fit data divided by the fit function
          with the best-fit parameters use
  
              fit.show_plots()
  
          This method has optional keyword arguments ``save`` and ``view``;
          see documentation for :class:`lsqfit.MultiFitter.show_plots`
          for more information. Plotting requires module :mod:`matplotlib`.
  
          To bootstrap a fit, use ``fit.bootstrapped_fit_iter(...)``;
          see :meth:`lsqfit.nonlinear_fit.bootstrapped_fit_iter` for more
          information.
  
          Args:
              data: Input data. One of ``data`` or ``pdata`` must be
                  specified but not both. ``pdata`` is obtained from ``data``
                  by collecting the output from ``m.builddata(data)``
                  for each model ``m`` and storing it in a dictionary
                  with key ``m.datatag``.
              pdata: Input data that has been processed by the
                  models using :meth:`MultiFitter.process_data` or
                  :meth:`MultiFitter.process_dataset`. One of
                  ``data`` or ``pdata`` must be  specified but not both.
              prior (dict): Bayesian prior for fit parameters used by the models.
              p0: Dictionary , indexed by parameter labels, containing
                  initial values for the parameters in the fit. Setting
                  ``p0=None`` implies that initial values are extracted from the
                  prior. Setting ``p0="filename"`` causes the fitter to look in
                  the file with name ``"filename"`` for initial values and to
                  write out best-fit parameter values after the fit (for the
                  next call to ``self.lsqfit()``).
              kargs: Arguments that (temporarily) override parameters specified
                  when the :class:`MultiFitter` was created. Can also include
                  additional arguments to be passed through to the :mod:`lsqfit`
                  fitter.
          """
          # gather parameters
          if prior is None:
              raise ValueError('no prior')
          kargs, oldargs = self.set(**kargs)
  
          # save parameters for bootstrap (in case needed)
          fitter_args_kargs = (
              self.chained_lsqfit,
              dict(data=data, prior=prior, pdata=pdata, models=self.models),
              dict(kargs),
              )
  
          # build prior, data and function
          fitprior = self.buildprior(prior=prior, mopt=self.mopt)
          fitdata = self.builddata(
              mopt=self.mopt, data=data, pdata=pdata, prior=prior
              )
          fitfcn = self.buildfitfcn()
  
          # fit
          self.fit = lsqfit.nonlinear_fit(
              data=fitdata, prior=fitprior, fcn=fitfcn, p0=p0,
              **self.fitterargs
              )
          if len(self.flatmodels) > 1:
              fname = self.fitname(
                  '(' +
                  ','.join([self.fitname(k.datatag) for k in self.flatmodels])
                  + ')'
                  )
          else:
              fname = self.fitname(self.flatmodels[0].datatag)
          self.fit.chained_fits = collections.OrderedDict([(fname, self.fit)])
  
          # add methods for printing and plotting
          def _formatall(*args, **kargs):
              " Add-on method for fits returned by chained_lsqfit. "
              ans = ''
              for x in self.fit.chained_fits:
                  ans += 10 * '=' + ' ' + str(x) + '\n'
                  ans += self.fit.chained_fits[x].format(*args, **kargs)
                  ans += '\n'
              return ans[:-1]
          self.fit.formatall = _formatall
          def _show_plots(save=False, view='ratio'):
              MultiFitter.show_plots(
                  fitdata=fitdata, fitval=fitfcn(self.fit.p),
                  save=save, view=view,
                  )
          self.fit.show_plots = _show_plots
  
          # restore default keywords
          self.set(**oldargs)
  
          # add bootstrap method
          fitter_args_kargs[1]['p0'] = self.fit.pmean
          def _bstrap_iter(
              n=None, datalist=None, pdatalist=None, **kargs
              ):
              return MultiFitter._bootstrapped_fit_iter(
                  fitter_args_kargs,
                  n=n, datalist=datalist, pdatalist=pdatalist, **kargs
                  )
          self.fit.bootstrapped_fit_iter = _bstrap_iter
          return self.fit