Fix ImportError's on Python3
Encode email before hashing