def send(self, message=None, delivery_tag=None, txn=None, **kwargs): self.wait(self.capacity) if message: kwargs["message_format"] = 0 kwargs["payload"] = encode(message) if delivery_tag is None: delivery_tag = message.delivery_tag if txn is not None: kwargs["state"] = TransactionalState(Binary(txn)) return self.proto.send(delivery_tag=delivery_tag, **kwargs)