code: def get_formatted_S(
      _S: Union[List[List[int]], np.ndarray],
      ts_names: List[str],
  ) -> pd.DataFrame:
      """
      We format the summation matrix S as a dataframe,
      where the index and columns have the
      corresponding time series names.
      """
  
      S = np.array(_S)
  
      return pd.DataFrame(
          S, index=ts_names, columns=ts_names[S.shape[0] - S.shape[1] :]
      )
  
imports: from typing import List, Optional, Union, Any, Dict
  import numpy
  import pandas
  from statsforecast import StatsForecast
  from hierarchicalforecast.core import HierarchicalReconciliation
  from hierarchicalforecast.core import _build_fn_name
  from gluonts.core.component import validated
  from gluonts.dataset import DataEntry
  from gluonts.dataset.util import forecast_start
  from gluonts.model.predictor import RepresentablePredictor
  from gluonts.model.forecast import QuantileForecast
  from gluonts.ext.statsforecast import ModelConfig
label_desc: Use image node_id 1 for calling a global function with example usage: get_formatted_S(_S, ts_names) and returns: pd