code: def run_pipeline_tuning(time_series, len_forecast, pipeline_type):
      # Source time series
      train_input, predict_input = train_test_data_setup(
          InputData(
              idx=range(len(time_series)),
              features=time_series,
              target=time_series,
              task=Task(
                  TaskTypesEnum.ts_forecasting,
                  TsForecastingParams(forecast_length=len_forecast),
              ),
              data_type=DataTypesEnum.ts,
          )
      )
  
      if pipeline_type == "with_fit":
          pipeline = get_fitting_custom_pipeline()
          # Setting custom search space for tuner (necessary)
          # model and output_type should be wrapped into hyperopt
          custom_search_space = {
              "custom": {
                  "alpha": {
                      "hyperopt-dist": hp.uniform,
                      "sampling-scope": [0.01, 10],
                      "type": "continuous",
                  }
              }
          }
      elif pipeline_type == "without_fit":
          pipeline = get_domain_pipeline()
          # Setting custom search space for tuner (necessary)
          # model and output_type should be wrapped into hyperopt
          custom_search_space = {
              "custom": {
                  "a": {
                      "hyperopt-dist": hp.uniform,
                      "sampling-scope": [-100, 100],
                      "type": "continuous",
                  },
                  "b": {
                      "hyperopt-dist": hp.uniform,
                      "sampling-scope": [0, 1000],
                      "type": "continuous",
                  },
              }
          }
      pipeline.fit_from_scratch(train_input)
      pipeline.print_structure()
      # Get prediction with initial approximation
      predicted_before_tuning = pipeline.predict(predict_input).predict
  
      replace_default_search_space = True
      cv_folds = 3
      search_space = PipelineSearchSpace(
          custom_search_space=custom_search_space,
          replace_default_search_space=replace_default_search_space,
      )
      pipeline_tuner = (
          TunerBuilder(train_input.task)
          .with_tuner(SimultaneousTuner)
          .with_metric(RegressionMetricsEnum.RMSE)
          .with_cv_folds(cv_folds)
          .with_iterations(10)
          .with_search_space(search_space)
          .build(train_input)
      )
      # Tuning pipeline
      pipeline = pipeline_tuner.tune(pipeline)
      # Fit pipeline on the entire train data
      pipeline.fit_from_scratch(train_input)
      # Predict tuned pipeline
      predicted_values = pipeline.predict(predict_input).predict
      pipeline.print_structure()
  
      plt.plot(
          np.arange(len(predicted_before_tuning[0])),
          predicted_before_tuning[0],
          label="Before tuning",
      )
      plt.plot(
          np.arange(len(predicted_values[0])),
          predicted_values[0],
          label="After tuning",
      )
      plt.plot(
          np.arange(len(predict_input.target)),
          predict_input.target,
          label="Real",
      )
      plt.legend()
      plt.show()
  
imports: import matplotlib.pyplot
  import numpy
  import pandas
  from golem.core.tuning.simultaneous import SimultaneousTuner
  from hyperopt import hp
  from sklearn.linear_model import Ridge
  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.tuning.search_space import PipelineSearchSpace
  from fedot.core.pipelines.tuning.tuner_builder import TunerBuilder
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.metrics_repository import RegressionMetricsEnum
  from fedot.core.repository.tasks import TaskTypesEnum, Task, TsForecastingParams
label_desc: Use image node_id 6 for calling a global function with example usage: run_pipeline_tuning(time_series, len_forecast, pipeline_type) without return types