Add setup.py and fix formatting/layout to be more pythonic

Also works with Python 2 (at least the tests do).