Use codecs module when encoding strings to be python3 compatible
Changes to conform with pypi packages