def _matchReportKeys(reportKeyREs=[], allReportKeys=[]):
 matchingReportKeys = []
 for keyRE in reportKeyREs:
  matchObj = re.compile(keyRE)
  found = False
  for keyName in allReportKeys:
   match = matchObj.match(keyName)
   if (match and (match.end() == len(keyName))):
    matchingReportKeys.append(keyName)
    found = True
  if (not found):
   raise _BadKeyError(keyRE)
 return matchingReportKeys

def _matchReportKeys ( reportKeyREs = [ ] , allReportKeys = [ ] ) : matchingReportKeys = [ ] for keyRE in reportKeyREs : matchObj = re . compile ( keyRE ) found = False for keyName in allReportKeys : match = matchObj . match ( keyName ) if ( match and ( match . end ( ) == len ( keyName ) ) ) : matchingReportKeys . append ( keyName ) found = True if ( not found ) : raise _BadKeyError ( keyRE ) return matchingReportKeys
extract all items from the allkeys list whose key matches one of the regular expressions passed in reportkeys .