code: def opt_wrapper(func):
      def f(*args, **kwargs):
          err = func(*args, **kwargs)
          if isinstance(err, np.ndarray):
              return err.T @ err
          return err
  
      return f
  
imports: from statsmodels.compat.pandas import deprecate_kwarg
  import contextlib
  from typing import Any
  from collections.abc import Hashable, Sequence
  import warnings
  import numpy
  import pandas
  from scipy.optimize import basinhopping, least_squares, minimize
  from scipy.special import inv_boxcox
  from scipy.stats import boxcox
  from statsmodels.tools.validation import array_like, bool_like, dict_like, float_like, int_like, string_like
  from statsmodels.tsa.base.tsa_model import TimeSeriesModel
  from statsmodels.tsa.exponential_smoothing.ets import _initialization_heuristic, _initialization_simple
  from statsmodels.tsa.holtwinters import _exponential_smoothers, _smoothers
  from statsmodels.tsa.holtwinters._exponential_smoothers import HoltWintersArgs
  from statsmodels.tsa.holtwinters._smoothers import to_restricted, to_unrestricted
  from statsmodels.tsa.holtwinters.results import HoltWintersResults, HoltWintersResultsWrapper
  from statsmodels.tsa.tsatools import freq_to_period
label_desc: Use image node_id 1 for calling a global function with example usage: opt_wrapper(func) and returns: f, err, unknown