code: def wait_for(fn: Callable[[], bool], timeout=None) -> bool:
      deadline = time.time() + timeout if timeout else None
      while True:
          if deadline is not None and time.time() > deadline:
              return False
  
          done = fn()
          if done:
              return True
  
          time.sleep(1)
  
imports: import os
  import threading
  import time
  from concurrent import futures
  from http import HTTPStatus
  from typing import Any, List, Optional, Tuple, Union, Dict, Callable
  import cortex
  import requests
  import yaml
label_desc: Use image node_id 1 for calling a global function with example usage: wait_for(fn, timeout) and returns: False, True