class_docstr: Class (or function) decorated with the `@serve.deployment` decorator.
  
  This is run on a number of replica actors. Requests to those replicas call
  this class.
  
  One or more deployments can be composed together into an `Application` which is
  then run via `serve.run` or a config file.
  
  Example:
  
  .. code-block:: python
  
      @serve.deployment
      class MyDeployment:
          def __init__(self, name: str):
              self._name = name
  
          def __call__(self, request):
              return "Hello world!"
  
          app = MyDeployment.bind()
          # Run via `serve.run` or the `serve run` CLI command.
          serve.run(app)
docstr: Get a ServeHandle to this deployment to invoke it from Python.
  
  Args:
      sync: If true, then Serve will return a ServeHandle that
          works everywhere. Otherwise, Serve will return an
          asyncio-optimized ServeHandle that's only usable in an asyncio
          loop.
  
  Returns:
      ServeHandle
docstr_tok: ["Get","a","ServeHandle","to","this","deployment","to","invoke","it","from","Python",".","Args",":","sync",":","If","true",",","then","Serve","will","return","a","ServeHandle","that","works","everywhere",".","Otherwise",",","Serve","will","return","an","asyncio-optimized","ServeHandle","that","'s","only","usable","in","an","asyncio","loop",".","Returns",":","ServeHandle"]
code: def _get_handle(
      self,
      sync: Optional[bool] = True,
  ) -> Union[RayServeHandle, RayServeSyncHandle]:
      """Get a ServeHandle to this deployment to invoke it from Python.
  
      Args:
          sync: If true, then Serve will return a ServeHandle that
              works everywhere. Otherwise, Serve will return an
              asyncio-optimized ServeHandle that's only usable in an asyncio
              loop.
  
      Returns:
          ServeHandle
      """
  
      return _get_global_client().get_handle(
          self._name,
          app_name="",
          missing_ok=True,
          sync=sync,
          use_new_handle_api=False,
      )
  
imports: import inspect
  import logging
  import warnings
  from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from ray.dag.class_node import ClassNode
  from ray.dag.dag_node import DAGNodeBase
  from ray.dag.function_node import FunctionNode
  from ray.serve._private.config import DeploymentConfig, ReplicaConfig
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import DEFAULT, Default
  from ray.serve.config import AutoscalingConfig
  from ray.serve.context import _get_global_client
  from ray.serve.handle import RayServeHandle, RayServeSyncHandle
  from ray.serve.schema import DeploymentSchema, LoggingConfig, RayActorOptionsSchema
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 22 for calling the Deployment obj's underlying member method code with example usage: obj._get_handle(sync) and returns: _get_global_client