code: def auto_ets(y, m):
      data_positive = min(y) > 0
      errortype = ["add", "mul"]
      trendtype = [None, "add"]
      seasontype = [None, "add", "mul"]
      damped = [True, False]
      best_ic = np.inf
      for etype in errortype:
          for ttype in trendtype:
              for stype in seasontype:
                  for dtype in damped:
                      if ttype is None and dtype:
                          continue
                      if etype == "add" and (
                          ttype == "mul" and stype == "mul"
                      ):
                          continue
                      if (
                          etype == "mul"
                          and ttype == "mul"
                          and stype == "add"
                      ):
                          continue
                      if (not data_positive) and etype == "mul":
                          continue
                      if stype in ["add", "mul"] and m == 1:
                          continue
                      model = ETSModel(
                          y,
                          error=etype,
                          trend=ttype,
                          damped_trend=dtype,
                          seasonal=stype,
                          seasonal_periods=m,
                      )
                      model = model.fit(disp=False)
                      fit_ic = model.aicc
                      if not np.isnan(fit_ic):
                          if fit_ic < best_ic:
                              best_model = model
      return best_model
  
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 1 for calling a global function with example usage: auto_ets(y, m) and returns: best_model