Added script for Python 3 users.

Converted the generation script to work in Python 3.