docs: def publish_message(channel, exchange, routing_key, message, properties=None, mandatory=False):
  	"""
  	Publish a message to an AMQP exchange.
  
  	Parameters
  	----------
  	channel: object
  		Properly initialized AMQP channel to use.
  	exchange: string
  		Exchange to publish to.
  	routing_key: string
  		Routing key to use for this message.
  	message: string
  		Message to publish.
  	properties: dict
  		Properties to set on message. This parameter is optional, but if set, at least the following options must be set:
  			content_type: string - what content_type to specify, default is 'text/plain'.
  			delivery_mode: int - what delivery_mode to use. By default message are not persistent, but this can be
  				set by specifying PERSISTENT_MESSAGE .
  		The following options are also available:
  			routing_key: string - what routing_key to use. Will override the one set in the parameters.
  			exchange: string - what exchange to use. Will override the one set in the parameters.
  	mandatory: boolean
  		If set to True, the mandatory bit will be set on the published message.
  
  	Returns
  	-------
  	Depending on the mode of the Channel, the return value can signify different things:
  
  	basic_Confirm is active:
  		True means that the message has been delivered to a queue, False means it hasn't.
  	mandatory bit was set on message:
  		True means that the message has been delivered to a consumer, False means that it has been returned.
  	No special bit or mode has been set:
  		None is returned.
  	"""
  	if properties is None:
  		properties = {}
  	if properties and "routing_key" in properties:
  		routing_key = properties["routing_key"]
  		del(properties["routing_key"])
  	if properties and "exchange" in properties:
  		exchange = properties["exchange"]
  		del(properties["exchange"])
  
  	if not routing_key:
  		raise ValueError("routing_key was not specified")
  	if not exchange and not exchange == "":
  		raise ValueError("exchange was not specified")
  
  	logging.getLogger(__name__ + ".publish_message").debug("Publishing message to exchange {0} with routing_key {1}".format(exchange, routing_key))
  
  	return channel.basic_publish(exchange, routing_key, message, pika.BasicProperties(**properties), mandatory)