'Publish to the channel with the given exchange, routing key and body.
For more information on basic_publish and what the parameters do, see:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish
:param exchange: The exchange to publish to
:type exchange: str or unicode
:param routing_key: The routing key to bind on
:type routing_key: str or unicode
:param body: The message body
:type body: str or unicode
:param pika.spec.BasicProperties properties: Basic.properties
:param bool mandatory: The mandatory flag
:param bool immediate: The immediate flag'

def basic_publish(self, exchange, routing_key, body, properties=None, mandatory=False, immediate=False):

    if (not self.is_open):
        raise exceptions.ChannelClosed()
    if immediate:
        LOGGER.warning('The    immediate    flag    is    deprecated    in    RabbitMQ')
    if isinstance(body, unicode_type):
        body = body.encode('utf-8')
    properties = (properties or spec.BasicProperties())
    self._send_method(spec.Basic.Publish(exchange=exchange, routing_key=routing_key, mandatory=mandatory, immediate=immediate), (properties, body))
