def safe_unicode(e):
 try:
  return unicode_type(e)
 except UnicodeError:
  pass
 try:
  return str_to_unicode(str(e))
 except UnicodeError:
  pass
 try:
  return str_to_unicode(repr(e))
 except UnicodeError:
  pass
 return u'Unrecoverably corrupt evalue'

def safe_unicode ( e ) : try : return unicode_type ( e ) except UnicodeError : pass try : return str_to_unicode ( str ( e ) ) except UnicodeError : pass try : return str_to_unicode ( repr ( e ) ) except UnicodeError : pass return u'Unrecoverably corrupt evalue'
unicode(e) with various fallbacks .