code: def wait(func, timeout=None):
      """Wait for func to return True until timeout."""
      start = int(time.time())
      while not func():
          time.sleep(0.1)
          if timeout is not None and int(time.time()) - start > timeout:
              raise TimeoutError(
                  "Timed out waiting for func to return True"
              )
  
imports: import contextlib
  import multiprocessing
  import os
  import shutil
  import sys
  import tempfile
  import time
  import traceback
  import cloudpickle
  import mock
  from horovod.runner.util.threads import in_thread
label_desc: Use image node_id 3 for calling a global function with example usage: wait(func, timeout) without return types