docstr: Function for composing FEDOT pipeline model 
docstr_tok: ["Function","for","composing","FEDOT","pipeline","model"]
code: def obtain_model(
      self, train_data: InputData
  ) -> Tuple[Pipeline, Sequence[Pipeline], OptHistory]:
      """Function for composing FEDOT pipeline model"""
      timeout: float = self.params.timeout
      with_tuning = self.params.get("with_tuning")
  
      self.timer = ApiTime(
          time_for_automl=timeout, with_tuning=with_tuning
      )
  
      (
          initial_assumption,
          fitted_assumption,
      ) = self.propose_and_fit_initial_assumption(train_data)
  
      multi_objective = len(self.metrics) > 1
      self.params.init_params_for_composing(
          self.timer.timedelta_composing, multi_objective
      )
  
      self.log.message(
          f"AutoML configured."
          f" Parameters tuning: {with_tuning}."
          f" Time limit: {timeout} min."
          f" Set of candidate models: {self.params.get('available_operations')}."
      )
  
      (
          best_pipeline,
          best_pipeline_candidates,
          gp_composer,
      ) = self.compose_pipeline(
          train_data, initial_assumption, fitted_assumption
      )
      if with_tuning:
          best_pipeline = self.tune_final_pipeline(
              train_data, best_pipeline
          )
      if gp_composer.history:
          adapter = self.params.graph_generation_params.adapter
          gp_composer.history.tuning_result = adapter.adapt(
              best_pipeline
          )
      # enforce memory cleaning
      gc.collect()
  
      self.log.message("Model generation finished")
      return (
          best_pipeline,
          best_pipeline_candidates,
          gp_composer.history,
      )
  
imports: import datetime
  import gc
  from copy import deepcopy
  from typing import List, Optional, Sequence, Tuple, Union
  from golem.core.log import default_log
  from golem.core.optimisers.opt_history_objects.opt_history import OptHistory
  from golem.core.tuning.simultaneous import SimultaneousTuner
  from fedot.api.api_utils.assumptions.assumptions_handler import AssumptionsHandler
  from fedot.api.api_utils.params import ApiParams
  from fedot.api.time import ApiTime
  from fedot.core.caching.pipelines_cache import OperationsCache
  from fedot.core.caching.preprocessing_cache import PreprocessingCache
  from fedot.core.composer.composer_builder import ComposerBuilder
  from fedot.core.composer.gp_composer.gp_composer import GPComposer
  from fedot.core.constants import DEFAULT_TUNING_ITERATIONS_NUMBER
  from fedot.core.data.data import InputData
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.pipelines.tuning.tuner_builder import TunerBuilder
  from fedot.core.repository.metrics_repository import MetricIDType
label_desc: Use image node_id 3 for calling the ApiComposer obj's underlying member method code with example usage: obj.obtain_model(train_data) and returns: best_pipeline,  best_pipeline_candidates,  gp_composer