code: def has_final_operation_as_model(pipeline: Pipeline):
      """Check if the operation in root node is model or not"""
      root_node = pipeline.root_node
      if root_node.operation.operation_type == atomized_model_type():
          has_final_operation_as_model(root_node.operation.pipeline)
      elif not isinstance(root_node.operation, Model):
          raise ValueError(
              f"{ERROR_PREFIX} Root operation is not a model"
          )
      return True
  
imports: from typing import Optional
  from fedot.core.operations.atomized_model import AtomizedModel
  from fedot.core.operations.model import Model
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.operation_types_repository import OperationTypesRepository, get_operations_for_task, atomized_model_type
  from fedot.core.repository.tasks import Task, TaskTypesEnum
label_desc: Use image node_id 3 for calling a global function with example usage: has_final_operation_as_model(pipeline) and returns: True