Fixed some things in generate_headers.py for py3.x