follow PEP8, and add support for Python3

Basically modern-ized the entire library.