def METHOD_NAME(lines, path):
    found = []
    for line in lines:
        line = re.sub(r"^[\s#\%\.]*", "", line)
        line = line.rstrip()
        for i, line_regex in enumerate(license_line_regexes):
            if re.match(line_regex, line):
                # The first line of the license contains the copyright date.
                # We allow it to be out of date but print a warning if it is
                # out of date.
                if i == 0:
                    if not re.search(strict_date, line):
                        tty.debug("{0}: copyright date mismatch".format(path))
                found.append(i)
    if len(found) == len(license_line_regexes) and found == list(sorted(found)):
        return
    def old_license(line, path):
        if re.search("This program is free software", line):
            print("{0}: has old LGPL license header".format(path))
            return OLD_LICENSE
    # If the SPDX identifier is present, then there is a mismatch (since it
    # did not match the above regex)
    def wrong_spdx_identifier(line, path):
        m = re.search(r"SPDX-License-Identifier: ([^\n]*)", line)
        if m and m.group(1) != apache2_mit_spdx:
            print(
                "{0}: SPDX license identifier mismatch"
                "(expecting {1}, found {2})".format(path, apache2_mit_spdx, m.group(1))
            )
            return SPDX_MISMATCH
    checks = [old_license, wrong_spdx_identifier]
    for line in lines:
        for check in checks:
            error = check(line, path)
            if error:
                return error
    print(
        "{0}: the license header at the top of the file does not match the \
          expected format".format(
            path
        )
    )
    return GENERAL_MISMATCH