code: def _modify_class(cls):
      # cls has been modified.
      if hasattr(cls, "__ray_actor_class__"):
          return cls
  
      # Give an error if cls is an old-style class.
      if not issubclass(cls, object):
          raise TypeError(
              "The @ray.remote decorator cannot be applied to old-style "
              "classes. In Python 2, you must declare the class with "
              "'class ClassName(object):' instead of 'class ClassName:'."
          )
  
      # Modify the class to have additional default methods.
      class Class(cls):
          __ray_actor_class__ = cls  # The original actor class
  
          def __ray_ready__(self):
              return True
  
          def __ray_call__(self, fn, *args, **kwargs):
              return fn(self, *args, **kwargs)
  
          def __ray_terminate__(self):
              worker = ray._private.worker.global_worker
              if worker.mode != ray.LOCAL_MODE:
                  ray.actor.exit_actor()
  
      Class.__module__ = cls.__module__
      Class.__name__ = cls.__name__
  
      if not is_function_or_method(getattr(Class, "__init__", None)):
          # Add __init__ if it does not exist.
          # Actor creation will be executed with __init__ together.
  
          # Assign an __init__ function will avoid many checks later on.
          def __init__(self):
              pass
  
          Class.__init__ = __init__
  
      return Class
  
imports: import inspect
  import logging
  import weakref
  from typing import Any, Dict, List, Optional, Union
  import ray._private.ray_constants
  import ray._private.signature
  import ray._private.worker
  import ray._raylet
  from ray import ActorClassID, Language, cross_language
  from ray._private import ray_option_utils
  from ray._private.async_compat import is_async_func
  from ray._private.auto_init_hook import wrap_auto_init
  from ray._private.client_mode_hook import client_mode_convert_actor, client_mode_hook, client_mode_should_convert
  from ray._private.inspect_util import is_class_method, is_function_or_method, is_static_method
  from ray._private.ray_option_utils import _warn_if_using_deprecated_placement_group
  from ray._private.utils import get_runtime_env_info, parse_runtime_env
  from ray._raylet import STREAMING_GENERATOR_RETURN, ObjectRefGenerator, PythonFunctionDescriptor, raise_sys_exit_with_custom_error_message
  from ray.exceptions import AsyncioActorExit
  from ray.util.annotations import DeveloperAPI, PublicAPI
  from ray.util.placement_group import _configure_placement_group_based_on_context
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy, SchedulingStrategyT
  from ray.util.tracing.tracing_helper import _inject_tracing_into_class, _tracing_actor_creation, _tracing_actor_method_invocation
label_desc: Use image node_id 3 for calling a global function with example usage: _modify_class(cls) and returns: Class, cls, True, fn