Make the python scripts compatible with python3

RE https://github.com/CocoaPods/Specs/issues/7124