code: def apply_method_defaults(fit_func):
      """Decorator for `greykite.algo.reconcile.convex.reconcile_forecasts.ReconcileAdditiveForecasts.fit`.
      Fetches parameters based on ``method`` and calls ``fit_func`` with the result.
  
      Parameters
      ----------
      fit_func : `callable`
          Should be `greykite.algo.reconcile.convex.reconcile_forecasts.ReconcileAdditiveForecasts.fit`.
  
      Returns
      -------
      apply_defaults_and_fit : callable
          Function that overwrites ``fit_params`` with those specified by ``method``
          and calls ``fit_func`` with those params.
      """
  
      @functools.wraps(fit_func)
      def apply_defaults_and_fit(
          self, forecasts, actuals, **fit_params
      ):
          """Overwrites ``fit_params`` with those specified by ``fit_params["method"]``.
          Calls ``fit_func`` with those params.
  
          Parameters
          ----------
          self : `ReconcileAdditiveForecasts`
              Self. Decorator should be applied to ``ReconcileAdditiveForecasts.fit()``.
          forecasts : `pandas.DataFrame`
              Forecasted values to pass to ``fit_func``.
          actuals : `pandas.DataFrame`
              Actual values to pass to ``fit_func``.
          fit_params : `dict`
              Original parameters used to call ``fit_func``.
              These are overridden by the ones corresponding to ``method``.
  
          Returns
          -------
          output : Any
              Same as the output of ``fit_func``.
          """
          method = fit_params.get("method", DEFAULT_METHOD)
          method_fit_params = get_fit_params(method)
          params = dict(fit_params, **method_fit_params)
          return fit_func(self, forecasts, actuals, **params)
  
      return apply_defaults_and_fit
  
imports: import functools
  import logging
  import math
  import sys
  import warnings
  from dataclasses import dataclass
  from typing import Optional
  import cvxpy
  import numpy
  import pandas
  import plotly
  import plotly.express
  from plotly import graph_objects
  from plotly.subplots import make_subplots
  from scipy.linalg import sqrtm
  from sklearn.exceptions import NotFittedError
  from greykite.algo.reconcile.hierarchical_relationship import HierarchicalRelationship
  from greykite.common.python_utils import reorder_columns
label_desc: Use image node_id 3 for calling a global function with example usage: apply_method_defaults(fit_func) and returns: apply_defaults_and_fit, fit_func