Ported to Python 3

Still need to fix some breakages in TCP code, so not all features are generated, but the app seems to run well otherwise.