code: def wait_for_file(self, fn: str, max_wait_sec: int = 3600 * 24 * 365,
                      check_interval: float = 0.02) -> bool:
      
      print("Waiting for file", fn)
      start_time = time.time()
      while True:
        if time.time() - start_time > max_wait_sec:
          util.log(f"Timeout exceeded ({max_wait_sec} sec) for {fn}")
          return False
        if not self.exists(fn):
          time.sleep(check_interval)
          continue
        else:
          break
      return True
docs: Waits for file maximum of max_wait_sec. Returns True if file was detected within specified max_wait_sec
      Args:
        fn: filename on task machine
        max_wait_sec: how long to wait in seconds
        check_interval: how often to check in seconds
      Returns:
        False if waiting was was cut short by max_wait_sec limit, True otherwise