code: def extract_task_param(task: Task) -> Any:
      try:
          task_params = task.task_params
          if isinstance(task_params, TsForecastingParams):
              prediction_len = task_params.forecast_length
              return prediction_len
          else:
              raise ValueError("Incorrect parameters type for data")
      except AttributeError as ex:
          raise AttributeError(
              f"Params are required for the {task} task: {ex}"
          )
  
file_path: FEDOT/fedot/core/repository/tasks.py
imports: from dataclasses import dataclass
  from typing import Any, List, Optional
  from golem.utilities.data_structures import ComparableEnum
label_desc: Use image node_id 2 for calling a global function with example usage: extract_task_param(task) and returns: prediction_len