code: def fit_binlh(f, data, bins=30,
                bound=None, quiet=False, weights=None, use_w2=False,
                print_level=0, pedantic=True, extended=False,
                *arg, **kwd):
      
      uml = BinnedLH(f, data, bins=bins, bound=bound,
                     weights=weights, use_w2=use_w2, extended=extended)
      minuit = Minuit(uml, print_level=print_level, pedantic=pedantic, **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 bin likelihood fit
      :param f:
      :param data:
      :param bins:
      :param range:
      :param quiet:
      :param weights:
      :param use_w2:
      :param printlevel:
      :param pedantic:
      :param extended:
      :param arg:
      :param kwd:
      :return: