def METHOD_NAME(self, event, machine_metadata):
    message = json.dumps(event.serialize(machine_metadata=machine_metadata)).encode("utf-8")
    kwargs = {"event_type": event.event_type}
    if event.metadata.routing_key:
        kwargs["routing_key"] = event.metadata.routing_key
    self.producer_client.publish(self.out_topic, message, **kwargs)