docs: def basic_publish(self, msg, exchange='', routing_key='',
          mandatory=False, immediate=False, ticket=None):
          """
          publish a message
  
          This method publishes a message to a specific exchange. The
          message will be routed to queues as defined by the exchange
          configuration and distributed to any active consumers when the
          transaction, if any, is committed.
  
          PARAMETERS:
              exchange: shortstr
  
                  Specifies the name of the exchange to publish to.  The
                  exchange name can be empty, meaning the default
                  exchange.  If the exchange name is specified, and that
                  exchange does not exist, the server will raise a
                  channel exception.
  
                  RULE:
  
                      The server MUST accept a blank exchange name to
                      mean the default exchange.
  
                  RULE:
  
                      If the exchange was declared as an internal
                      exchange, the server MUST raise a channel
                      exception with a reply code 403 (access refused).
  
                  RULE:
  
                      The exchange MAY refuse basic content in which
                      case it MUST raise a channel exception with reply
                      code 540 (not implemented).
  
              routing_key: shortstr
  
                  Message routing key
  
                  Specifies the routing key for the message.  The
                  routing key is used for routing messages depending on
                  the exchange configuration.
  
              mandatory: boolean
  
                  indicate mandatory routing
  
                  This flag tells the server how to react if the message
                  cannot be routed to a queue.  If this flag is True, the
                  server will return an unroutable message with a Return
                  method.  If this flag is False, the server silently
                  drops the message.
  
                  RULE:
  
                      The server SHOULD implement the mandatory flag.
  
              immediate: boolean
  
                  request immediate delivery
  
                  This flag tells the server how to react if the message
                  cannot be routed to a queue consumer immediately.  If
                  this flag is set, the server will return an
                  undeliverable message with a Return method. If this
                  flag is zero, the server will queue the message, but
                  with no guarantee that it will ever be consumed.
  
                  RULE:
  
                      The server SHOULD implement the immediate flag.
  
              ticket: short
  
                  RULE:
  
                      The client MUST provide a valid access ticket
                      giving "write" access rights to the access realm
                      for the exchange.
  
          """
          args = AMQPWriter()
          if ticket is not None:
              args.write_short(ticket)
          else:
              args.write_short(self.default_ticket)
          args.write_shortstr(exchange)
          args.write_shortstr(routing_key)
          args.write_bit(mandatory)
          args.write_bit(immediate)
  
          self._send_method((60, 40), args, msg)