code: def publish(self, msg, exchange, routing_key, mandatory=False,
                  immediate=False, ticket=None):
          '''
          publish a message.
          '''
          args = Writer()
          args.write_short(ticket or self.default_ticket).\
              write_shortstr(exchange).\
              write_shortstr(routing_key).\
              write_bits(mandatory, immediate)
  
          self.send_frame(MethodFrame(self.channel_id, 60, 40, args))
          self.send_frame(
              HeaderFrame(self.channel_id, 60, 0, len(msg), msg.properties))
  
          f_max = self.channel.connection.frame_max
          for f in ContentFrame.create_frames(self.channel_id, msg.body, f_max):
              self.send_frame(ff publish(self, msg, exchange, routing_key, mandatory=False,
                  immediate=False, ticket=None):
          '''
          publish a message.
          '''
          args = Writer()
          args.write_short(ticket or self.default_ticket).\
              write_shortstr(exchange).\
              write_shortstr(routing_key).\
              write_bits(mandatory, immediate)
  
          self.send_frame(MethodFrame(self.channel_id, 60, 40, args))
          self.send_frame(
              HeaderFrame(self.channel_id, 60, 0, len(msg), msg.properties))
  
          f_max = self.channel.connection.frame_max
          for f in ContentFrame.create_frames(self.channel_id, msg.body, f_max):
              self.send_frame(f)
docs: publish a message.