code: def _initialize_levels_model_selection_multiseries(
      forecaster,
      series: pd.DataFrame,
      levels: Optional[Union[str, list]] = None,
  ) -> list:
      """
      Initialize levels for model_selection_multiseries functions.
  
      Parameters
      ----------
      forecaster : ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate
          Forecaster model.
      series : pandas DataFrame
          Training time series.
      levels : str, list, default `None`
          level (`str`) or levels (`list`) at which the forecaster is optimized.
          If `None`, all levels are taken into account. The resulting metric will be
          the average of the optimization of all levels.
  
      Returns
      -------
      levels : list
          List of levels to be used in model_selection_multiseries functions.
  
      """
  
      if (
          type(forecaster).__name__
          in [
              "ForecasterAutoregMultiSeries",
              "ForecasterAutoregMultiSeriesCustom",
          ]
          and levels is not None
          and not isinstance(levels, (str, list))
      ):
          raise TypeError(
              (
                  "`levels` must be a `list` of column names, a `str` of a column name "
                  "or `None` when using a `ForecasterAutoregMultiSeries` or "
                  "`ForecasterAutoregMultiSeriesCustom`. If the forecaster is of type "
                  "`ForecasterAutoregMultiVariate`, this argument is ignored."
              )
          )
  
      if type(forecaster).__name__ == "ForecasterAutoregMultiVariate":
          if (
              levels
              and levels != forecaster.level
              and levels != [forecaster.level]
          ):
              warnings.warn(
                  (
                      f"`levels` argument have no use when the forecaster is of type "
                      f"`ForecasterAutoregMultiVariate`. The level of this forecaster "
                      f"is '{forecaster.level}', to predict another level, change "
                      f"the `level` argument when initializing the forecaster. \n"
                  ),
                  IgnoredArgumentWarning,
              )
          levels = [forecaster.level]
      else:
          if levels is None:
              # Forecaster could be untrained, so self.series_col_names cannot be used.
              levels = list(series.columns)
          elif isinstance(levels, str):
              levels = [levels]
  
      return levels
  
imports: from typing import Union, Tuple, Optional, Callable
  import numpy
  import pandas
  import warnings
  import logging
  from copy import deepcopy
  from joblib import Parallel, delayed, cpu_count
  from tqdm.auto import tqdm
  from sklearn.model_selection import ParameterGrid
  from sklearn.model_selection import ParameterSampler
  import optuna
  from optuna.samplers import TPESampler, RandomSampler
  from ..exceptions import LongTrainingWarning
  from ..exceptions import IgnoredArgumentWarning
  from ..model_selection.model_selection import _get_metric
  from ..model_selection.model_selection import _create_backtesting_folds
  from ..utils import check_backtesting_input
  from ..utils import initialize_lags_grid
  from ..utils import select_n_jobs_backtesting
label_desc: Use image node_id 1 for calling a global function with example usage: _initialize_levels_model_selection_multiseries(forecaster, series, levels) and returns: levels