fix except syntax for python3
fix unicode check for compatible with python3
dict items for python3