code: def hold_sync(self):
          
          if self._holding_sync is True:
              yield
          else:
              try:
                  self._holding_sync = True
                  yield
              finally:
                  self._holding_sync = False
                  self.send_state(self._states_to_send)
                  self._states_to_send.clear()
docs: Hold syncing any state until the outermost context manager exits