add support for Python 3.2 and 3.3, retain backward compatibility

This updates the Python scripts to work with the latest Python (3.3), and continues to support 2.6 and 2.7. Most of the changes are just to use the print function instead of the special syntax used in 2.x.