support both mosquitto-python 0.x and 1.x