code: def fit_binx2(f, data, bins=30, bound=None, print_level=0, quiet=False, *arg, **kwd):
      
      uml = BinnedChi2(f, data, bins=bins, bound=bound)
      minuit = Minuit(uml, print_level=print_level, **kwd)
      minuit.set_strategy(2)
      minuit.migrad()
      if not minuit.migrad_ok() or not minuit.matrix_accurate():
          if not quiet:
              from matplotlib import pyplot as plt
              plt.figure()
              uml.show()
              print(minuit.values)
  
      return (uml, minuit)
docs: perform chi^2 fit
      :param f:
      :param data:
      :param bins:
      :param range:
      :param printlevel:
      :param quiet:
      :param arg:
      :param kwd:
      :return: