code: def test_gp_composer_random_graph_generation_looping(max_depth):
      """Test checks random_graph valid generation without freezing in loop of creation."""
      task = Task(TaskTypesEnum.regression)
  
      operations = get_operations_for_task(task, mode="model")
      primary_operations = operations[: len(operations) // 2]
      secondary_operations = operations[len(operations) // 2 :]
      requirements = PipelineComposerRequirements(
          primary=primary_operations,
          secondary=secondary_operations,
          timeout=datetime.timedelta(seconds=300),
          max_graph_fit_time=None,
          max_depth=max_depth,
          max_arity=2,
          cv_folds=None,
          num_of_generations=5,
      )
  
      params = get_pipeline_generation_params(
          requirements=requirements, task=task
      )
  
      graphs = [
          params.random_graph_factory(requirements) for _ in range(4)
      ]
      for graph in graphs:
          for node in graph.nodes:
              if node.nodes_from:
                  assert node.content["name"] in requirements.secondary
              else:
                  assert node.content["name"] in requirements.primary
          assert params.verifier(graph) is True
          assert graph.depth <= requirements.max_depth
  
imports: import datetime
  from pathlib import Path
  import numpy
  import pandas
  import pytest
  from golem.core.optimisers.genetic.gp_params import GPAlgorithmParameters
  from golem.core.optimisers.genetic.operators.inheritance import GeneticSchemeTypesEnum
  from golem.core.optimisers.genetic.operators.selection import SelectionTypesEnum
  from golem.core.optimisers.random.random_search import RandomSearchOptimizer
  from sklearn.metrics import roc_auc_score
  from fedot import Fedot
  from fedot.core.caching.pipelines_cache import OperationsCache
  from fedot.core.composer.composer_builder import ComposerBuilder
  from fedot.core.composer.random_composer import RandomSearchComposer
  from fedot.core.data.data import InputData
  from fedot.core.optimisers.objective import PipelineObjectiveEvaluate
  from fedot.core.optimisers.objective.data_source_splitter import DataSourceSplitter
  from fedot.core.optimisers.objective.metrics_objective import MetricsObjective
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.pipelines.pipeline_composer_requirements import PipelineComposerRequirements
  from fedot.core.pipelines.pipeline_graph_generation_params import get_pipeline_generation_params
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.operation_types_repository import OperationTypesRepository, get_operations_for_task
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, ComplexityMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum
  from fedot.core.utils import fedot_project_root, set_random_seed
  from test.unit.pipelines.test_pipeline_comparison import pipeline_first, pipeline_second
label_desc: Use image node_id 12 for calling a global function with example usage: test_gp_composer_random_graph_generation_looping(max_depth) without return types