title: How to determine API version of Kafka?
body: <p>I am using <a href="https://pypi.org/project/kafka-python/" rel="noreferrer">kafka-python</a> for accessing Kafka. I try to create a Kafka Producer:</p>
  
  <pre><code>kafka_producer = KafkaProducer(bootstrap_servers=['kafka:9092'])
  </code></pre>
  
  <p>but this fails with exception <em>kafka.errors.NoBrokersAvailable: NoBrokersAvailable</em>.</p>
  
  <p>I've found out I need to add <code>api_version</code> parameter to the KafkaProducer:</p>
  
  <pre><code>kafka_producer = KafkaProducer(bootstrap_servers=['kafka:9092'],
                                 api_version=(0, 10, 1))
  </code></pre>
  
  <p>This command works.</p>
  
  <p>The question is: <strong>how to determine value of <code>api_version</code></strong>?</p>
  
  <p><code>kafka-broker-api-versions.sh  --bootstrap-server localhost:9092</code> gives me something, but I am not sure if there's a number I can use. I tried random values like <code>api_version=(20, 2, 1)</code> and it also worked.</p>