class_docstr: Router that matches endpoint to return the handle.
class_docstr_tok: ["Router","that","matches","endpoint","to","return","the","handle","."]
docstr: Return the handle that matches with endpoint.
  
  Args:
      target_app_name: app_name to match against.
  Returns:
      (route, handle, app_name, is_cross_language) for the single app if there
      is only one, else find the app and handle for exact match. Else return None.
docstr_tok: ["Return","the","handle","that","matches","with","endpoint",".","Args",":","target_app_name",":","app_name","to","match","against",".","Returns",":","(","route",",","handle",",","app_name",",","is_cross_language",")","for","the","single","app","if","there","is","only","one",",","else","find","the","app","and","handle","for","exact","match",".","Else","return","None","."]
code: def get_handle_for_endpoint(
      self, target_app_name: str
  ) -> Optional[Tuple[str, RayServeHandle, bool]]:
      """Return the handle that matches with endpoint.
  
      Args:
          target_app_name: app_name to match against.
      Returns:
          (route, handle, app_name, is_cross_language) for the single app if there
          is only one, else find the app and handle for exact match. Else return None.
      """
      for endpoint_tag, handle in self.handles.items():
          # If the target_app_name matches with the endpoint or if
          # there is only one endpoint.
          if (
              target_app_name == endpoint_tag.app
              or len(self.handles) == 1
          ):
              endpoint_info = self.endpoints[endpoint_tag]
              return (
                  endpoint_info.route,
                  handle,
                  endpoint_info.app_is_cross_language,
              )
  
      return None
  
file_path: ray/python/ray/serve/_private/proxy_router.py
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Callable, Dict, List, Optional, Tuple
  from ray.serve._private.common import ApplicationName, EndpointInfo, EndpointTag, RequestProtocol
  from ray.serve._private.constants import RAY_SERVE_PROXY_PREFER_LOCAL_NODE_ROUTING, SERVE_LOGGER_NAME
  from ray.serve.handle import RayServeHandle
label_desc: Use image node_id 3 for calling the EndpointRouter obj's underlying member method code with example usage: obj.get_handle_for_endpoint(target_app_name) and returns: None, endpoint_info,  handle,  endpoint_info