code: def fit_and_predict(index, ts, horizon, freq, seasonality):
      x = ts["y"].values
      try:
          mod = auto_ets(x, seasonality)
          forecast = mod.forecast(horizon)
      # print(forecast.flatten().flatten())
      except:
          forecast = random_walk_with_drift(x, horizon, None)
  
      forecast = pd.DataFrame(
          {
              "ds": np.arange(
                  ts["ds"].max() + 1, ts["ds"].max() + horizon + 1
              ),
              "ypred": forecast,
          }
      )
      forecast["unique_id"] = index
  
      return forecast[["unique_id", "ds", "ypred"]]
  
file_path: statsforecast/experiments/ets/src/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.models import random_walk_with_drift
  from src.data import get_data
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: forecast