code: def test_controller_deserialization_args_and_kwargs(
      shutdown_ray_and_serve,
  ):
      """Ensures init_args and init_kwargs stay serialized in controller."""
      serve.start()
      client = _get_global_client()
  
      class PidBasedString(str):
          pass
  
      def generate_pid_based_deserializer(pid, raw_deserializer):
          """Cannot be deserialized by the process with specified pid."""
  
          def deserializer(*args):
              import os
  
              if os.getpid() == pid:
                  raise RuntimeError(
                      "Cannot be deserialized by this process!"
                  )
              else:
                  return raw_deserializer(*args)
  
          return deserializer
  
      PidBasedString.__reduce__ = generate_pid_based_deserializer(
          ray.get(client._controller.get_pid.remote()),
          PidBasedString.__reduce__,
      )
  
      @serve.deployment
      class Echo:
          def __init__(self, arg_str, kwarg_str="failed"):
              self.arg_str = arg_str
              self.kwarg_str = kwarg_str
  
          def __call__(self, request):
              return self.arg_str + self.kwarg_str
  
      serve.run(
          Echo.bind(
              PidBasedString("hello "),
              kwarg_str=PidBasedString("world!"),
          )
      )
  
      assert (
          requests.get("http://localhost:8000/Echo").text
          == "hello world!"
      )
  
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 12 for calling a global function with example usage: test_controller_deserialization_args_and_kwargs(shutdown_ray_and_serve) and returns: deserializer, unknown, raw_deserializer