class MessageQueue: messages = [] def append(self, message): self.messages.append(message) def shift(self): return self.messages.pop(0) def pending(self): return len(self.messages) > 0