code: def train_test_split(dataframe: pd.DataFrame, forecast_horizon: int):
      train_df = []
      test_df = []
      for ts in list(dataframe["label"].unique()):
          ts_dataframe = dataframe[dataframe["label"] == ts]
          ts_dataframe = ts_dataframe.sort_values(by="datetime")
  
          train_len = len(ts_dataframe) - forecast_horizon
          train_df.append(ts_dataframe.head(train_len))
          test_df.append(ts_dataframe.tail(forecast_horizon))
  
      train_df = pd.concat(train_df)
      test_df = pd.concat(test_df)
      return train_df, test_df
  
file_path: FEDOT/cases/multivariate_ts_forecasting.py
imports: import matplotlib.pyplot
  import numpy
  import pandas
  from fedot import Fedot
  from fedot.core.repository.tasks import TsForecastingParams
  from fedot.core.utils import fedot_project_root
label_desc: Use image node_id 1 for calling a global function with example usage: train_test_split(dataframe, forecast_horizon) and returns: train_df,  test_df