encode and decode in py3