Error device-mqtt-go with python device simulator


I followed the official guide and regarding the commissioning of the mqtt device service is ok.
I found it a bit difficult to start the javascript script with the container, so I decided to “translate” it into python.

I can run the command that changes the value of “message” and it’s ok, but when I execute any commands “get” I obtain ever some error like this in case of ping get:

edgex-device-mqtt  | level=INFO ts=2019-10-24T16:58:07.998849995Z app=edgex-device-mqtt source=responselistener.go:63 msg="[Response listener] Command response received: topic=CommandTopic uuid=5db1d81fb8dd790001196ed8 msg={\"cmd\":\"ping\",\"method\":\"get\",\"uuid\":\"5db1d81fb8dd790001196ed8\"}"
edgex-device-mqtt  | level=INFO ts=2019-10-24T16:58:08.006393298Z app=edgex-device-mqtt source=driver.go:163 msg="Parse command response: {\"cmd\":\"ping\",\"method\":\"get\",\"uuid\":\"5db1d81fb8dd790001196ed8\"}"
edgex-device-mqtt  | level=INFO ts=2019-10-24T16:58:08.014736157Z app=edgex-device-mqtt source=driver.go:122 msg="Handle read commands failed: can not fetch command reading: method=get cmd=ping"

My code is this:

def handler_command_topic(paylaod):
    global message
    data = loads(paylaod)
    if data['method'] == 'set':
        message = data.message
        print(f"new message: {message}")
        if data['cmd'] == 'ping':
            data['ping'] = 'pong'
        elif data['cmd']== 'message':
            data['message'] = message
        elif data['cmd'] == 'randnum':
            data['randnum'] = 12.123
    client.publish("ResponseTopic", payload = dumps(data))

def on_message(client, userdata, msg):
    print('Topic: ' + msg.topic + '\nMessage: ' + str(msg.payload))
    if msg.topic == 'CommandTopic':

deviceName = "MQ_DEVICE"
client = mqtt.Client("DeviceSimulator") #create new instance
client.on_connect = on_connect
client.on_message = on_message
client.connect(broker_address) #connect to broker

I remain available for any questions on the written code.
Thanks in advance…