def exc_message(exc_info):
 exc = exc_info[1]
 if (exc is None):
  result = exc_info[0]
 else:
  try:
   result = str(exc)
  except UnicodeEncodeError:
   try:
    result = unicode(exc)
   except UnicodeError:
    result = exc.args[0]
 result = force_unicode(result, 'UTF-8')
 return xml_safe(result)

def exc_message ( exc_info ) : exc = exc_info [ 1 ] if ( exc is None ) : result = exc_info [ 0 ] else : try : result = str ( exc ) except UnicodeEncodeError : try : result = unicode ( exc ) except UnicodeError : result = exc . args [ 0 ] result = force_unicode ( result , 'UTF-8' ) return xml_safe ( result )
return the exceptions message .