code: def fit_and_predict(index, ts, horizon, freq, seasonality):
      levels = np.arange(55, 100, 5)
      alpha = np.flip(np.arange(0.05, 0.5, 0.05))
      x = ts["y"].values
      try:
          x = pd.Series(x)
          mod = auto_ets(x, seasonality)
          forecast = mod.get_prediction(
              start=x.index[-1] + 1, end=x.index[-1] + horizon
          )
          res = {}
  
          for k in range(0, len(levels)):
              pred_int = forecast.summary_frame(alpha=alpha[k])
              pred_int = pred_int.reset_index()
  
              res["ds"] = (pred_int["index"].values) + 1
              res["statsmodels_mean"] = pred_int["mean"].values
              res["statsmodels_lowerb_" + str(levels[k])] = pred_int[
                  "pi_lower"
              ].values
              res["statsmodels_upperb_" + str(levels[k])] = pred_int[
                  "pi_upper"
              ].values
  
          df = pd.DataFrame.from_dict(res)
          df["unique_id"] = np.repeat(ts["unique_id"].unique(), horizon)
          df = df[
              ["unique_id", "ds", "statsmodels_mean"]
              + ["statsmodels_lowerb_" + str(i) for i in levels]
              + ["statsmodels_upperb_" + str(i) for i in levels]
          ]
      except:
          x = ts
          x["ds"] = x["ds"].astype(int)
          models = [Naive()]
          fcst = StatsForecast(
              df=x, models=models, freq=freq, n_jobs=cpu_count()
          )
          df = fcst.forecast(h=horizon, level=levels)
          df = df.reset_index()
          df.columns = (
              ["unique_id", "ds", "statsmodels_mean"]
              + ["statsmodels_lowerb_" + str(i) for i in levels]
              + ["statsmodels_upperb_" + str(i) for i in levels]
          )
          df = df[
              ["unique_id", "ds", "statsmodels_mean"]
              + ["statsmodels_lowerb_" + str(i) for i in levels]
              + ["statsmodels_upperb_" + str(i) for i in levels]
          ]
  
      return df
  
file_path: statsforecast/experiments/ets_intervals/src/nb_statsmodels.py
imports: import time
  from copy import deepcopy
  from functools import partial
  from multiprocessing import Pool, cpu_count
  import fire
  import numpy
  import pandas
  from statsmodels.tsa.exponential_smoothing.ets import ETSModel
  from sktime.forecasting.ets import AutoETS
  from statsforecast import StatsForecast
  from statsforecast.models import Naive
  from src.data import get_data
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: fit_and_predict(index, ts, horizon, freq, seasonality) and returns: df