code: def _sync(self, timeout_ms=30000):
          
          response = self.api.sync(self.sync_token, timeout_ms)
          prev_sync_token = self.sync_token
          self.sync_token = response["next_batch"]
  
          if self._handle_thread is not None:
              # if previous _handle_thread is still running, wait for it and re-raise if needed
              self._handle_thread.get()
  
          is_first_sync = (prev_sync_token is None)
          self._handle_thread = gevent.Greenlet(self._handle_response, response, is_first_sync)
          self._handle_thread.name = (
              f'GMatrixClient._sync user_id:{self.user_id} sync_token:{prev_sync_token}'
          )
          self._handle_thread.link_exception(lambda g: self.sync_thread.kill(g.exception))
          self._handle_thread.start()
  
          if self._post_hook_func is not None:
              self._post_hook_func(self.sync_token)
docs: Reimplements MatrixClient._sync, add 'account_data' support to /sync