code: def forecast_ets(obj, h, level=None):
      fcst = pegelsfcast_C(h, obj)
      out = {"mean": fcst}
      out["residuals"] = obj["residuals"]
      out["fitted"] = obj["fitted"]
      if level is not None:
          pi = _compute_pred_intervals(
              model=obj, forecasts=out, level=level, h=h
          )
          out = {**out, **pi}
      return out
  
imports: import math
  from collections import namedtuple
  from typing import Tuple
  import numpy
  from numba import njit
  from numba.typed import List
  from statsmodels.tsa.seasonal import seasonal_decompose
  from .utils import _calculate_intervals, CACHE, NOGIL
label_desc: Use image node_id 26 for calling a global function with example usage: forecast_ets(obj, h, level) and returns: out