code: def test_secede_rejoin_busy():
      with ThreadPoolExecutor(2) as e:
          # Prime threads
          f1 = e.submit(sleep, 0.1)
          f2 = e.submit(sleep, 0.1)
          f1.result()
          f2.result()
  
          def f():
              assert threading.current_thread() in e._threads
              secede()
              sleep(0.2)
              assert threading.current_thread() not in e._threads
              rejoin()
              assert len(e._threads) == 2
              assert threading.current_thread() in e._threads
              return threading.current_thread()
  
          future = e.submit(f)
          for _ in range(6):
              e.submit(sleep, 0.4)
          start = time()
          special_thread = future.result()
          stop = time()
  
          assert 0.2 < stop - start < 0.6
  
          assert len(e._threads) == 2
          assert special_thread in e._threads
  
          def f():
              sleep(0.01)
              return threading.current_thread()
  
          futures = [e.submit(f) for _ in range(10)]
          assert special_thread in {
              future.result() for future in futures
          }
  
file_path: distributed/distributed/tests/test_threadpoolexecutor.py
imports: from __future__ import annotations
  import threading
  from time import sleep
  from distributed.metrics import time
  from distributed.threadpoolexecutor import ThreadPoolExecutor, rejoin, secede
label_desc: Use image node_id 5 for calling a global function with example usage: test_secede_rejoin_busy() and returns: threading, threading