def dispatch(self, routing_key, payload, trace_context=None):
        """
        Method which dispatches the announcement.

        :param routing_key: Routing key of the announcement.
        :type routing_key: ``str``

        :param payload: Announcement payload.
        :type payload: ``dict``

        :param trace_context: Trace context to associate with Announcement.
        :type trace_context: ``TraceContext``
        """
        if not isinstance(payload, (type(None), dict)):
            raise TypeError(
                f"The payload has a value that is not a dictionary (was {type(payload)})."
            )
        if not isinstance(trace_context, (type(None), dict, TraceContext)):
            raise TypeError(
                "The trace context has a value that is not a NoneType or dict or TraceContext"
                f" (was {type(trace_context)})."
            )

        payload = {"payload": payload, TRACE_CONTEXT: trace_context}

        self._logger.debug(
            "Dispatching announcement (routing_key=%s,payload=%s)", routing_key, payload
        )
        self._publisher.publish(payload=payload, routing_key=routing_key)

        Method which dispatches the announcement.

        :param routing_key: Routing key of the announcement.
        :type routing_key: ``str``

        :param payload: Announcement payload.
        :type payload: ``dict``

        :param trace_context: Trace context to associate with Announcement.
        :type trace_context: ``TraceContext``
        
st2common/st2common/transport/announcement.py