Python 3 fix: Unicode-objects must be encoded before hashing