code: def test_nonserializable_deployment(serve_instance):
      lock = threading.Lock()
  
      class D:
          def hello(self, _):
              return lock
  
      # Check that the `inspect_serializability` trace was printed
      with pytest.raises(
          TypeError,
          match=r"Could not serialize the deployment[\s\S]*was found to be non-serializable.*",  # noqa
      ):
          serve.deployment(D)
  
      @serve.deployment
      class E:
          def __init__(self, arg):
              self.arg = arg
  
      with pytest.raises(TypeError, match="pickle"):
          serve.run(E.bind(lock))
  
      with pytest.raises(TypeError, match="pickle"):
          serve.run(E.bind(arg=lock))
  
imports: import functools
  import os
  import sys
  import threading
  import time
  from concurrent.futures.thread import ThreadPoolExecutor
  from typing import Dict
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.pydantic_compat import ValidationError
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.serve._private.common import ApplicationStatus
  from ray.serve._private.logging_utils import get_component_log_file_name, get_serve_logs_dir
  from ray.util.state import list_actors
label_desc: Use image node_id 6 for calling a global function with example usage: test_nonserializable_deployment(serve_instance) and returns: lock