def _grep_log_for_errors(log):
    matchings = []
    it = iter(log.splitlines())
    for line in it:
        is_error_line = ('ERROR' in line
                         and 'DEBUG' not in line.split('ERROR')[0])
        if is_error_line:
            matchings.append([line])
            try:
                it, peeker = itertools.tee(it)
                while 'INFO' not in next(peeker):
                    matchings[-1].append(next(it))
            except __HOLE__:
                break
    return matchings
dataset/ETHPy150Open pcmanus/ccm/ccmlib/node.py/_grep_log_for_errors