Fixed pypackage.py to work with both python 2 and 3