code: def get_data(
      directory: str, dataset: str, group: str, train: bool = True
  ):
      if dataset not in dict_datasets.keys():
          raise Exception(f"dataset {dataset} not found")
  
      dataclass, datainfo = dict_datasets[dataset]
      if group not in datainfo.groups:
          raise Exception(f"group {group} not found for {dataset}")
  
      Y_df, *_ = dataclass.load(directory, group)
  
      horizon = datainfo[group].horizon
      freq = datainfo[group].freq
      seasonality = datainfo[group].seasonality
      Y_df_test = Y_df.groupby("unique_id").tail(horizon)
      Y_df = Y_df.drop(Y_df_test.index)
  
      if train:
          return Y_df, horizon, freq, seasonality
  
      return Y_df_test, horizon, freq, seasonality
  
imports: import fire
  import pandas
  from datasetsforecast.m3 import M3, M3Info
label_desc: Use image node_id 1 for calling a global function with example usage: get_data(directory, dataset, group, train) and returns: Y_df_test,  horizon,  freq,  seasonality, Y_df,  horizon,  freq,  seasonality