PY3 port w3lib.encoding to Python 3.3