code: def initialize_lags_grid(
      forecaster, lags_grid: Optional[Union[list, dict]] = None
  ) -> Tuple[dict, str]:
      """
      Initialize lags grid and lags label for model selection.
  
      Parameters
      ----------
      forecaster : Forecaster
          Forecaster model. ForecasterAutoreg, ForecasterAutoregCustom,
          ForecasterAutoregDirect, ForecasterAutoregMultiSeries,
          ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate.
      lags_grid : list, dict, default `None`
          Lists of lags to try, containing int, lists, numpy ndarray, or range
          objects. If `dict`, the keys are used as labels in the `results`
          DataFrame, and the values are used as the lists of lags to try. Ignored
          if the forecaster is an instance of `ForecasterAutoregCustom` or
          `ForecasterAutoregMultiSeriesCustom`.
  
      Returns
      -------
      lags_grid : dict
          Dictionary with lags configuration for each iteration.
      lags_label : str
          Label for lags representation in the results object.
  
      """
  
      if not isinstance(lags_grid, (list, dict, type(None))):
          raise TypeError(
              (
                  f"`lags_grid` argument must be a list, dict or None. "
                  f"Got {type(lags_grid)}."
              )
          )
  
      if type(forecaster).__name__ in [
          "ForecasterAutoregCustom",
          "ForecasterAutoregMultiSeriesCustom",
      ]:
          if lags_grid is not None:
              warnings.warn(
                  (
                      f"`lags_grid` ignored if forecaster is an instance of "
                      f"`{type(forecaster).__name__}`."
                  ),
                  IgnoredArgumentWarning,
              )
          lags_grid = ["custom predictors"]
  
      lags_label = "values"
      if isinstance(lags_grid, list):
          lags_grid = {f"{lags}": lags for lags in lags_grid}
      elif lags_grid is None:
          lags_grid = {
              f"{list(forecaster.lags)}": list(forecaster.lags)
          }
      else:
          lags_label = "keys"
  
      return lags_grid, lags_label
  
imports: from typing import Union, Any, Optional, Tuple, Callable
  import warnings
  import importlib
  import joblib
  import numpy
  import pandas
  import sklearn
  import sklearn.pipeline
  import sklearn.linear_model
  from sklearn.compose import ColumnTransformer
  from sklearn.exceptions import NotFittedError
  import inspect
  from copy import deepcopy
  import skforecast
  from ..exceptions import MissingValuesExogWarning
  from ..exceptions import DataTypeWarning
  from ..exceptions import IgnoredArgumentWarning
  from ..exceptions import SkforecastVersionWarning
label_desc: Use image node_id 3 for calling a global function with example usage: initialize_lags_grid(forecaster, lags_grid) and returns: lags_grid,  lags_label