def ustr(obj):
if sys.version_info[<NUM_LIT:0>] == <NUM_LIT:2>:<EOL><INDENT>if type(obj) in [str, basestring]:  <EOL><INDENT>return unicode(obj, DEFAULT_ENCODING)  <EOL><DEDENT>else:<EOL><INDENT>return unicode(obj)  <EOL><DEDENT><DEDENT>else:<EOL><INDENT>if type(obj) in [bytes]:<EOL><INDENT>return obj.decode(DEFAULT_ENCODING)<EOL><DEDENT>else:<EOL><INDENT>return str(obj)<EOL><DEDENT><DEDENT>
Python 2 and 3 utility method that converts an obj to unicode in python 2 and to a str object in python 3