def extractErrorMessage(page):
 retVal = None
 if isinstance(page, basestring):
  for regex in ERROR_PARSING_REGEXES:
   match = re.search(regex, page, (re.DOTALL | re.IGNORECASE))
   if match:
    retVal = htmlunescape(match.group('result')).replace('<br>', '\n').strip()
    break
 return retVal

def extractErrorMessage ( page ) : retVal = None if isinstance ( page , basestring ) : for regex in ERROR_PARSING_REGEXES : match = re . search ( regex , page , ( re . DOTALL | re . IGNORECASE ) ) if match : retVal = htmlunescape ( match . group ( 'result' ) ) . replace ( '<br>' , '\n' ) . strip ( ) break return retVal
returns reported error message from page if it founds one .