code: def _walk_and_check_for_cycles(
      visited_so_far: List[Text], node_name: Text, schema: GraphSchema
  ) -> None:
      if node_name in visited_so_far:
          raise GraphSchemaValidationException(
              f"Node '{node_name}' has itself as dependency. Cycles are not allowed "
              f"in the graph. Please make sure that '{node_name}' does not have itself "
              f"specified in 'needs' and none of '{node_name}'s dependencies have "
              f"'{node_name}' specified in 'needs'."
          )
  
      if node_name not in schema.nodes:
          raise GraphSchemaValidationException(
              f"Node '{node_name}' is not part of the graph. Node was expected to be "
              f"present in the graph as it is used by another component."
          )
  
      parents = schema.nodes[node_name].needs.values()
      for parent_name in parents:
          if not _is_placeholder_input(parent_name):
              _walk_and_check_for_cycles(
                  [*visited_so_far, node_name], parent_name, schema
              )
  
imports: import inspect
  import logging
  import typing
  from typing import Optional, Callable, Text, Tuple, Dict, Type, Any, Set, Union, TypeVar, List
  import dataclasses
  from rasa.core.policies.policy import PolicyPrediction
  from rasa.engine.training.fingerprinting import Fingerprintable
  import rasa.utils.common
  import typing_utils
  from rasa.engine.exceptions import GraphSchemaValidationException
  from rasa.engine.graph import GraphSchema, GraphComponent, SchemaNode, ExecutionContext, GraphModelConfiguration
  from rasa.engine.constants import RESERVED_PLACEHOLDERS
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.shared.constants import DOCS_URL_GRAPH_COMPONENTS
  from rasa.shared.exceptions import RasaException
  from rasa.shared.nlu.training_data.message import Message
label_desc: Use image node_id 6 for calling a global function with example usage: _walk_and_check_for_cycles(visited_so_far, node_name, schema) without return types