code: def kafka_error_callback(err: "KafkaError") -> None:
      """Callback for Kafka errors.
  
      Any exception raised from this callback will be re-raised from the
      triggering flush() call.
      """
      from confluent_kafka import KafkaException, KafkaError
  
      # handle authentication / connection related issues, likely pointing
      # to a configuration error
      if (
          err.code() == KafkaError._ALL_BROKERS_DOWN
          or err.code() == KafkaError._AUTHENTICATION
          or err.code() == KafkaError._MAX_POLL_EXCEEDED
      ):
          raise KafkaException(err)
      else:
          logger.warning("A KafkaError has been raised.", exc_info=True)
  
imports: import asyncio
  import os
  import json
  import logging
  import structlog
  import threading
  from asyncio import AbstractEventLoop
  from typing import Any, Text, List, Optional, Union, Dict, TYPE_CHECKING
  import time
  from rasa.core.brokers.broker import EventBroker
  from rasa.core.exceptions import KafkaProducerInitializationError
  from rasa.shared.utils.io import DEFAULT_ENCODING
  from rasa.utils.endpoints import EndpointConfig
  import rasa.shared.utils.common
label_desc: Use image node_id 1 for calling a global function with example usage: kafka_error_callback(err) without return types