code: def get_composed_pipeline(dataset_to_compose, task, metric_function):
      # the search of the models provided by the framework that can be used as nodes in a pipeline for the selected task
      available_model_types = get_operations_for_task(
          task=task, mode="model"
      )
  
      # the choice and initialisation of the GP search
      composer_requirements = PipelineComposerRequirements(
          primary=available_model_types,
          secondary=available_model_types,
          max_arity=3,
          max_depth=3,
          num_of_generations=20,
      )
  
      optimizer_parameters = GPAlgorithmParameters(
          pop_size=15,
          mutation_prob=0.8,
          crossover_prob=0.8,
          genetic_scheme_type=GeneticSchemeTypesEnum.steady_state,
      )
  
      # Create composer and with required composer params
      composer = (
          ComposerBuilder(task=task)
          .with_requirements(composer_requirements)
          .with_optimizer_params(optimizer_parameters)
          .with_metrics(metric_function)
          .build()
      )
  
      # the optimal pipeline generation by composition - the most time-consuming task
      pipeline_evo_composed = composer.compose_pipeline(
          data=dataset_to_compose
      )
  
      return pipeline_evo_composed
  
imports: from os import makedirs
  from os.path import exists, join
  from golem.core.optimisers.genetic.gp_params import GPAlgorithmParameters
  from golem.core.optimisers.genetic.operators.inheritance import GeneticSchemeTypesEnum
  from fedot.core.pipelines.pipeline_composer_requirements import PipelineComposerRequirements
  from examples.simple.classification.classification_pipelines import classification_three_depth_manual_pipeline
  from examples.simple.regression.regression_pipelines import regression_three_depth_manual_pipeline
  from fedot.core.composer.composer_builder import ComposerBuilder
  from fedot.core.data.data import InputData
  from fedot.core.data.data_split import train_test_data_setup
  from fedot.core.repository.operation_types_repository import get_operations_for_task
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, MetricsRepository, RegressionMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum
  from fedot.core.utils import default_fedot_data_dir, fedot_project_root
  from fedot.structural_analysis.node_sa_approaches import NodeDeletionAnalyze, NodeReplaceOperationAnalyze
  from fedot.structural_analysis.nodes_sensitivity import NodesAnalysis
label_desc: Use image node_id 1 for calling a global function with example usage: get_composed_pipeline(dataset_to_compose, task, metric_function) and returns: pipeline_evo_composed