code: def wait_for_save(filename, timeout=5):
      
      modification_time = os.path.getmtime(filename)
      start_time = time.time()
      while time.time() < start_time + timeout:
          if (os.path.getmtime(filename) > modification_time and
              os.path.getsize(filename) > 0):
              return True
          time.sleep(0.2)
      return False
docs: Waits for FILENAME to update, waiting up to TIMEOUT seconds.
      Returns True if a save was detected, and False otherwise.