[PATCH-master-py3] Python2 to Python3 conversion fixes