code: def test_shutdown_wait(client):
      # shutdown(wait=True) waits for pending tasks to finish
      e = client.get_executor()
      start = time()
      fut = e.submit(sleep, 1.0)
      e.shutdown()
      assert time() >= start + 1.0
      sleep(0.1)  # wait for future outcome to propagate
      assert fut.done()
      fut.result()  # doesn't raise
  
      with pytest.raises(RuntimeError):
          e.submit(sleep, 1.0)
  
imports: from __future__ import annotations
  import random
  from concurrent.futures import FIRST_COMPLETED, FIRST_EXCEPTION, Future, TimeoutError, as_completed, wait
  from time import sleep
  import pytest
  from tlz import take
  from distributed.event import Event
  from distributed.metrics import time
  from distributed.utils import CancelledError
  from distributed.utils_test import inc, slowadd, slowinc, throws, varying
label_desc: Use image node_id 14 for calling a global function with example usage: test_shutdown_wait(client) without return types