Generator

Added generator.py and the test.