Replace ustr() by str()
The str() function calls the method __str__(), so try-except in ustr() can be removed.
utf-8 is the default encoding in Python3, so the last call of str(r, ENCODING) can be written as str(r).
Further simplified, we get ustr() is equal to str().