Fix generate.py for Python 3

This requires disabling XML validation because the included libraries aren't Python 3 compatible, but whatever. The code was also written to be generic, so that if the libraries ever fail on Python 2.7, the generator will also skip validation, so that's pretty nice.