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