def METHOD_NAME(self, dict_vars):
    try:
        topic = dict_vars["value"]["topic"]
    except:
        topic = self.topic
    try:
        payload = dict_vars["value"]["payload"]
    except:
        payload = self.payload
        try:
            if self.payload_type == 'integer':
                payload = int(payload)
            elif self.payload_type == 'float':
                payload = float(payload)
        except:
            msg = f" Error: Could not cast payload as {self.payload_type}."
            self.logger.error(msg)
            dict_vars['message'] += msg
            return dict_vars
    if not payload:
        msg = f" Error: Cannot publish to MQTT server without a payload."
        self.logger.error(msg)
        dict_vars['message'] += msg
        return dict_vars
    try:
        auth_dict = None
        if self.login:
            auth_dict = {
                "username": self.username,
                "password": self.password
            }
        self.publish.single(
            topic,
            payload,
            hostname=self.hostname,
            port=self.port,
            client_id=self.clientid,
            keepalive=self.keepalive,
            auth=auth_dict,
            transport='websockets' if self.mqtt_use_websockets else 'tcp')
        dict_vars['message'] += f" MQTT Publish '{payload}'."
    except Exception as err:
        msg = f" Could not execute MQTT Publish: {err}"
        self.logger.error(msg)
        dict_vars['message'] += msg
    self.logger.debug(f"Message: {dict_vars['message']}")
    return dict_vars