code: def _run_in_threads(test_fn, num_threads, parallel):
      threads = []
      for _ in range(num_threads):
          thread = threading.Thread(target=test_fn)
          thread.daemon = True
          thread.start()
          if parallel:
              threads.append(thread)
          else:
              thread.join()
      for thread in threads:
          thread.join()
  
imports: import multiprocessing
  import sys
  import threading
  import time
  import pytest
  import env
  from pybind11_tests import gil_scoped
label_desc: Use image node_id 21 for calling a global function with example usage: _run_in_threads(test_fn, num_threads, parallel) without return types