code: def get_ts_data(
      dataset="m4_monthly",
      horizon: int = 30,
      m4_id=None,
      validation_blocks=None,
  ):
      time_series = pd.read_csv(TS_DATASETS[dataset])
  
      task = Task(
          TaskTypesEnum.ts_forecasting,
          TsForecastingParams(forecast_length=horizon),
      )
      if "m4" in dataset:
          if not m4_id:
              label = random.choice(np.unique(time_series["label"]))
          else:
              label = m4_id
          print(label)
          time_series = time_series[time_series["label"] == label]
          idx = time_series["datetime"].values
      else:
          label = dataset
          if dataset not in ["australia"]:
              idx = pd.to_datetime(time_series["idx"].values)
          else:
              # non datetime indexes
              idx = time_series["idx"].values
  
      time_series = time_series["value"].values
      train_input = InputData(
          idx=idx,
          features=time_series,
          target=time_series,
          task=task,
          data_type=DataTypesEnum.ts,
      )
      train_data, test_data = train_test_data_setup(
          train_input, validation_blocks=validation_blocks
      )
      return train_data, test_data, label
  
file_path: FEDOT/examples/simple/time_series_forecasting/api_forecasting.py
imports: import logging
  import random
  import numpy
  import pandas
  from matplotlib import pyplot
  from fedot import Fedot
  from fedot.core.data.data import InputData
  from fedot.core.data.data_split import train_test_data_setup
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import TsForecastingParams, Task, TaskTypesEnum
  from fedot.core.utils import fedot_project_root
label_desc: Use image node_id 1 for calling a global function with example usage: get_ts_data(dataset, horizon, m4_id, validation_blocks) and returns: train_data,  test_data,  label