docs: def stop_gui_thread():
      """
      Try to stop the GUI thread. If it was running returns True,
      otherwise False.
      """
      PyGUIThread = getattr(ROOT, 'PyGUIThread', None)
  
      if PyGUIThread is None or not PyGUIThread.isAlive():
          log.debug("no existing GUI thread is runnng")
          return False
  
      ROOT.keeppolling = 0
      try:
          PyGUIThread.finishSchedule()
      except AttributeError:
          log.debug("unable to call finishSchedule() on PyGUIThread")
          pass
      PyGUIThread.join()
      log.debug("successfully stopped the existing GUI thread")
      return True