code: def fit(data, distribution='norm'):
      '''Calculate the parameters of a fit of a distribution to a data set
  
      Parameters:
          data: array of data points to be fitted
  
      Options:
          distribution (str): type of distribution to fit. Default 'norm'.
  
      Returns:
          FitResults object with fitted parameters, errors and distribution type
  
      Note:
          Uses Kolmogorov-Smirnov test to estimate distance and p-value.
      '''
      params = getattr(_st, distribution).fit(data)
      return FitResults(params, _st.kstest(data, distribution, params), distributionf fit(data, distribution='norm'):
      '''Calculate the parameters of a fit of a distribution to a data set
  
      Parameters:
          data: array of data points to be fitted
  
      Options:
          distribution (str): type of distribution to fit. Default 'norm'.
  
      Returns:
          FitResults object with fitted parameters, errors and distribution type
  
      Note:
          Uses Kolmogorov-Smirnov test to estimate distance and p-value.
      '''
      params = getattr(_st, distribution).fit(data)
      return FitResults(params, _st.kstest(data, distribution, params), distribution)
docs: Calculate the parameters of a fit of a distribution to a data set
  
      Parameters:
          data: array of data points to be fitted
  
      Options:
          distribution (str): type of distribution to fit. Default 'norm'.
  
      Returns:
          FitResults object with fitted parameters, errors and distribution type
  
      Note:
          Uses Kolmogorov-Smirnov test to estimate distance and p-value.