code: def fit_gaussian(x, y, yerr, p0):
      
      try:
          popt, pcov = curve_fit(gaussian, x, y, sigma=yerr, p0=p0, absolute_sigma=True)
      except RuntimeError:
          return [0],[0]
      return popt, pcov
docs: Fit a Gaussian to the data