code: def publish_message(host, amqp_settings, routing_key, data, async=False):
      
      global _thread
      global _num_pending
  
      kwargs = {
          "host": host,
          "amqp_settings": amqp_settings,
          "routing_key": routing_key,
          "data": data
      }
  
      if not async:
          return _publish_message(**kwargs)
  
      if _thread is None:
          with _lock:
              if _thread is None:
                  _thread = threading.Thread(target=_publish_messages_async)
                  _thread.daemon = True
                  _thread.start()
  
      with _lock:
          _num_pending += 1
  
      _queue.put(kwargs)
      return True
docs: Publish an AMQP message.
  
      Returns:
          bool: True if message was sent successfully.