code: def _wait_for_file(cls, filename, timeout=FAIL_WAIT_SEC, want_content=True):
      
      def file_waiter():
        return os.path.exists(filename) and (not want_content or os.path.getsize(filename))
  
      action_msg = 'file {} to appear'.format(filename)
      return cls._deadline_until(file_waiter, action_msg, timeout=timeout)
docs: Wait up to timeout seconds for filename to appear with a non-zero size or raise Timeout().