Ran 2to3. Fixed some errors manually.