code: def maybe_get_next_message(self):
          
          if self.pending:
              self.ioloop.add_callback(
                  self.invoke_consumer, self.pending.popleft())
docs: Pop the next message on the stack, adding a callback on the IOLoop
          to invoke the consumer with the message. This is done so we let the
          IOLoop perform any pending callbacks before trying to process the
          next message.