Python 3.x support + minor fixes.

Also made the following minor changes:
 - PEP8 compliancy
 - Changed some dictionary literals to constructors to make the code more readable
 - Removed a broken link from comments

Tested with 2.5, 2.6, 2.7, 3.2, 3.3 and 3.4b1