code: def get_and_validate_ingress_deployment(
      deployments: List[Deployment],
  ) -> Deployment:
      """Validation for http route prefixes for a list of deployments in pipeline.
  
      Ensures:
          1) One and only one ingress deployment with given route prefix.
          2) All other not ingress deployments should have prefix of None.
      """
  
      ingress_deployments = []
      for deployment in deployments:
          if deployment.route_prefix is not None:
              ingress_deployments.append(deployment)
  
      if len(ingress_deployments) != 1:
          raise ValueError(
              "Only one deployment in an Serve Application or DAG can have "
              f"non-None route prefix. {len(ingress_deployments)} ingress "
              f"deployments found: {ingress_deployments}"
          )
  
      return ingress_deployments[0]
  
imports: import inspect
  from collections import OrderedDict
  from typing import List
  from ray.dag import ClassNode, DAGNode
  from ray.dag.function_node import FunctionNode
  from ray.dag.utils import _DAGNodeNameGenerator
  from ray.experimental.gradio_utils import type_to_string
  from ray.serve._private.constants import RAY_SERVE_ENABLE_NEW_HANDLE_API, SERVE_DEFAULT_APP_NAME
  from ray.serve._private.deployment_executor_node import DeploymentExecutorNode
  from ray.serve._private.deployment_function_executor_node import DeploymentFunctionExecutorNode
  from ray.serve._private.deployment_function_node import DeploymentFunctionNode
  from ray.serve._private.deployment_node import DeploymentNode
  from ray.serve.deployment import Deployment, schema_to_deployment
  from ray.serve.handle import DeploymentHandle, RayServeHandle
  from ray.serve.schema import DeploymentSchema
label_desc: Use image node_id 2 for calling a global function with example usage: get_and_validate_ingress_deployment(deployments) and returns: ingress_deployments