Makes tools compatible with Py3K

Thanks to python-modernize.
UTF-8 validation now does bound-checking
Fix length of non-ASCII ident and string literals