Move generation code into a function.
Add initial setup.py script.