Port to Python 2/3 code base and fix for packaging.