Return information to a Kafka server

def returner(ret):
    '''
    Return information to a Kafka server
    '''
    if __salt__['config.option']('returner.kafka.topic'):
        topic = __salt__['config.option']('returner.kafka.topic')

        conn = _get_conn()
        producer = Producer({'bootstrap.servers': conn})
        producer.poll(0)
        producer.produce(topic, salt.utils.json.dumps(ret), str(ret).encode('utf-8'), callback=_delivery_report)

        producer.flush()
    else:
        log.error('Unable to find kafka returner config option: topic')