code: def main():
      # Create 'my-topic' Kafka topic
      try:
          admin = KafkaAdminClient(bootstrap_servers="localhost:9092")
  
          topic = NewTopic(
              name="my-topic", num_partitions=1, replication_factor=1
          )
          admin.create_topics([topic])
      except Exception:
          pass
  
      tasks = [Producer(), Consumer()]
  
      # Start threads of a publisher/producer and a subscriber/consumer to 'my-topic' Kafka topic
      for t in tasks:
          t.start()
  
      time.sleep(10)
  
      # Stop threads
      for task in tasks:
          task.stop()
  
      for task in tasks:
          task.join()
  
file_path: kafka-python/example.py
imports: import threading, time
  from kafka import KafkaAdminClient, KafkaConsumer, KafkaProducer
  from kafka.admin import NewTopic
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types