Python 3-compatible checking for unicode