def _ustr(obj):
 try:
  return str(obj)
 except UnicodeEncodeError as e:
  return unicode(obj)

def _ustr ( obj ) : try : return str ( obj ) except UnicodeEncodeError as e : return unicode ( obj )
drop-in replacement for str that tries to be unicode friendly .