Python 3 compatibility & unittests

Note: I didn't get a chance to test this on Python 2, since my python2 virtualenv for Err broke somehow.