topic_desc = subprocess.check_output([os.path.join(KAFKABIN,
    'kafka-topics.sh'), '--describe', '--topic', wanted, '--zookeeper',
    '{}:2181'.format(KAFKAHOST)])
if not topic_desc:
    pass
Check whether a Kafka topic exists in Python