code: def _all_actors_dead(ray):
      import ray as real_ray
      import ray._private.gcs_utils as gcs_utils
  
      def _all_actors_dead_internal():
          return all(
              actor["State"]
              == convert_actor_state(gcs_utils.ActorTableData.DEAD)
              for actor in list(
                  real_ray._private.state.actors().values()
              )
          )
  
      return _all_actors_dead_internal
  
file_path: ray/python/ray/tests/test_client_terminate.py
imports: import sys
  import time
  import pytest
  from ray._private.test_utils import convert_actor_state, wait_for_condition
  from ray.exceptions import GetTimeoutError, ObjectLostError, RayTaskError, TaskCancelledError, WorkerCrashedError
  from ray.tests.client_test_utils import create_remote_signal_actor
  from ray.util.client.ray_client_helpers import ray_start_client_server
label_desc: Use image node_id 2 for calling a global function with example usage: _all_actors_dead(ray) and returns: _all_actors_dead_internal, all