def publish(self, msg=None):
    if msg:
        info('mqtt', ('publish: ' + str(msg)))
        mid = self.client.publish(msg.topic, payload=msg.payload_str(), qos=self.qos)
        self.dur_count += 1
        self.dur_total += msg.get_duration()
        info('mqtt', (((((('published ' + str(self.dur_count)) + ' for an avg. duration of ') + str(self.dur_avg())) + ' secs. with ') + str(self.dur_total)) + ' secs. in total'))
def publish(self, msg=None):
    if msg:
        info('mqtt', ('publish: ' + str(msg)))
        mid = self.client.publish(msg.topic, payload=msg.payload_str(), qos=self.qos)
        self.dur_count += 1
        self.dur_total += msg.get_duration()
        info('mqtt', (((((('published ' + str(self.dur_count)) + ' for an avg. duration of ') + str(self.dur_avg())) + ' secs. with ') + str(self.dur_total)) + ' secs. in total'))