import re


def SummariseErrorsAndWarnings( data ):
    """Search for the line '*** # Errors, # Warnings' in the output file and
    extract the count of errors and warnings reported"""
    regex = re.compile( "\*\*\* (\\d+) Errors, (\\d+) Warnings" )
    errors = 0
    warnings = 0
    for m in re.findall( regex, data ):
        errors += int( m[0] )
        warnings += int( m[1] )
    return (errors, warnings)