code: def _command_callback(self, message):
          
          payload = message['payload']
          if message['$'] == 'before':
              self._commands.append({'level': self._depth,
                                     'payload': payload,
                                     'logs': []})
              self._depth += 1
          else:
              while not self._queue.empty():
                  self._commands[-1]['logs'].append(self._queue.get())
              self._depth = max(self._depth-1, 0)
docs: The callback subscribed to the broker