def get_error_message(error):
 try:
  return error.args[0]
 except IndexError:
  return ''

def get_error_message ( error ) : try : return error . args [ 0 ] except IndexError : return ''
returns error message of the last occurred exception .