code: def main_loop(self, timeout=None):
          
          if self.trigger_event.wait(timeout):
              try:
                  self.func()
              except Exception as e:
                  self.logger.warning("Got an exception running {func}: {e}".format(func=self.func, e=str(e)))
              finally:
                  self.trigger_event.clear()
docs: Check if self.trigger_event is set. If it is, then run our function. If not, return early.
          :param timeout: How long to wait for a trigger event. Defaults to 0.
          :return: