code: def fitNormalization(self, specVals, xlims):
          
          from scipy.optimize import brentq
  
          def fDeriv(x): return self.norm_derivative(specVals, x)
          try:
              result = brentq(fDeriv, xlims[0], xlims[1])
          except:
              check_underflow = self.__call__(specVals * xlims[0]) < \
                  self.__call__(specVals * xlims[1])
              if check_underflow.any():
                  return xlims[0]
              else:
                  return xlims[1]
          return result
docs: Fit the normalization given a set of spectral values that
          define a spectral shape
  
          This version is faster, and solves for the root of the derivatvie
  
          Parameters
          ----------
          specVals :  an array of (nebin values that define a spectral shape
          xlims    :  fit limits     
  
          returns the best-fit normalization value