code: def delivery_report(err: Exception, msg: "Message") -> None:
      """Reports the failure or success of a message delivery.
  
      Args:
          err (KafkaError): The error that occurred on None on success.
          msg (Message): The message that was produced or failed.
      """
      if err is not None:
          logger.error(
              f"Delivery failed for User record {msg.key()}: {err}"
          )
          return
  
      logger.info(
          f"User record {msg.key()} successfully produced to "
          f"{msg.topic()} [{msg.partition()}] at offset {msg.offset()}."
      )
  
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 2 for calling a global function with example usage: delivery_report(err, msg) without return types