def METHOD_NAME(lines):
    i = 0
    lastError = None
    while i < len(lines):
        errDesc = parseErrorLine(lines[i])
        if errDesc:
            if lastError:
                errors.append(lastError)
            lastError = (errDesc, [])
        else:
            if lastError:
                lastError[1].append(lines[i])
            else:
                eprint("ignored error line", lines[i])
        i += 1
    if lastError:
        errors.append(lastError)
    list.sort(errors, key=lambda error: error[0][0])