As promised in #2014. There are virtually no real changes between Python 2 and 3 in this module, but the stub had accumulated some meaningless differences. I also fixed a few incorrect types.