code: def _validate_target(
      target_name: Text,
      target_type: Text,
      expected_type: Type,
      schema: GraphSchema,
  ) -> None:
      if target_name not in schema.nodes:
          raise GraphSchemaValidationException(
              f"Graph schema specifies invalid {target_type} target '{target_name}'. "
              f"Please make sure specify a valid node name as target."
          )
  
      if any(
          target_name in node.needs.values()
          for node in schema.nodes.values()
      ):
          raise GraphSchemaValidationException(
              f"One graph node uses the {target_type} target '{target_name}' as input. "
              f"This is not allowed as NLU prediction and Core prediction are run "
              f"separately."
          )
  
      target_node = schema.nodes[target_name]
      _, target_return_type = _get_parameter_information(
          target_node.uses, target_node.fn
      )
  
      if not typing_utils.issubtype(target_return_type, expected_type):
          raise GraphSchemaValidationException(
              f"Your {target_type} model's output component "
              f"'{target_node.uses.__name__}' returns an invalid return "
              f"type '{target_return_type}'. This is not allowed. The {target_type} "
              f"model's last component is expected to return the type '{expected_type}'. "
              f"See {DOCS_URL_GRAPH_COMPONENTS} for more information."
          )
  
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 4 for calling a global function with example usage: _validate_target(target_name, target_type, expected_type, schema) without return types