code: def prepare_ts_for_in_sample(forecast_length: int, horizon: int):
      """Prepare input data for time series forecasting task. In-sample forecasting
      can be applied on this data
  
      :param forecast_length: forecast horizon for model
      :param horizon: horizon for validation
      """
      ts = np.array(
          [
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              101,
          ]
      )
  
      # Forecast for 2 elements ahead
      task = Task(
          TaskTypesEnum.ts_forecasting,
          TsForecastingParams(forecast_length=forecast_length),
      )
  
      input_data = InputData(
          idx=np.arange(0, len(ts)),
          features=ts,
          target=ts,
          task=task,
          data_type=DataTypesEnum.ts,
      )
      train_input, predict_input = train_test_data_setup(
          input_data,
          **{"validation_blocks": round(horizon / forecast_length)},
      )
      return train_input, predict_input
  
imports: import os
  import numpy
  import pandas
  from sklearn.metrics import mean_absolute_percentage_error
  from fedot.core.data.data import InputData
  from fedot.core.data.data_split import train_test_data_setup
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.pipelines.pipeline_builder import PipelineBuilder
  from fedot.core.pipelines.ts_wrappers import fitted_values
  from fedot.core.pipelines.ts_wrappers import in_sample_ts_forecast, out_of_sample_ts_forecast, in_sample_fitted_values
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum, TsForecastingParams
  from fedot.core.utils import fedot_project_root
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_ts_for_in_sample(forecast_length, horizon) and returns: train_input,  predict_input