code: def format_data_entry(
      entry: DataEntry, S: pd.DataFrame
  ) -> pd.DataFrame:
      """
      Format data entry as required by hierarchicalforecast.
  
      ``entry`` is a dictionary with keys: ``"start"``, ``"item_id"``, ``"target"``.
      ``entry["target"]`` is a ``np.ndarray`` with shape ``(num_ts, num_timestamps)``,
      and each row corresponds to one time series of the hierarchy.
      The goal is to reshape this DataEntry as a dataframe where:
      1) the index corresponds to the name of the time series,
      2) the columns ``"ds"`` and ``"y"`` correspond to timestamps and actuals, respectively.
      """
  
      df = pd.DataFrame(entry["target"]).T
      df.columns = S.index.tolist()
      df.index = pd.date_range(
          start=entry["start"].start_time,
          periods=df.shape[0],
          freq=entry["start"].freq,
      )
  
      df = unpivot(df)
      df = df.set_index("unique_id")
  
      return df
  
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 2 for calling a global function with example usage: format_data_entry(entry, S) and returns: df