code: def shutdown_ray_and_serve():
      serve.shutdown()
      if ray.is_initialized():
          ray.shutdown()
      yield
      serve.shutdown()
      if ray.is_initialized():
          ray.shutdown()
  
imports: import os
  import subprocess
  import sys
  from contextlib import contextmanager
  from tempfile import NamedTemporaryFile
  import pytest
  import requests
  import ray
  import ray._private.state
  import ray.actor
  from ray import serve
  from ray._private.test_utils import wait_for_condition
  from ray.exceptions import RayActorError
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE
  from ray.serve.context import _get_global_client
  from ray.tests.conftest import call_ray_stop_only
  from ray.util.state import list_actors
label_desc: Use image node_id 1 for calling a global function with example usage: shutdown_ray_and_serve() without return types