https://github.com/PostHog/posthog/pull/3280
ee/kafka_client/client.py
def __init__(self, kafka_enabled=KAFKA_ENABLED):
        if kafka_enabled:
            self.send_to_kafka = True
            self.producer = KafkaProducer()
        else:
            self.send_to_kafka = False
    def produce(self, sql: str, topic: str, data: Dict[str, Any], sync: bool = True):
        if self.send_to_kafka:
            self.producer.produce(topic=topic, data=data)
        else:
            if sync:
                sync_execute(sql, data)
            else:
                async_execute(sql, data)