code: def wait_for_file(fname, timeout=10):
      """Check whether file is created within certain amount of time."""
      end_time = time.time() + timeout
      while time.time() < end_time:
          if os.path.exists(fname):
              return True
          time.sleep(0.05)
      return False
  
imports: import json
  import os
  import time
  import numpy
  from numpy.testing import assert_allclose
  import pytest
  from lmfit import Parameters
  import lmfit.jsonutils
  from lmfit.lineshapes import gaussian, lorentzian
  from lmfit.model import Model, ModelResult, load_model, load_modelresult, save_model, save_modelresult
  from lmfit.models import ExponentialModel, ExpressionModel, GaussianModel, VoigtModel
label_desc: Use image node_id 2 for calling a global function with example usage: wait_for_file(fname, timeout) and returns: False, True