def METHOD_NAME(path):
    with open(path, encoding='utf-8-sig') as f:
        contents = f.read()
    license_header = parse_license_header(contents)
    relpath = path.relative_to(check_path).as_posix()
    previous = get_previous(path)
    # When file already existed
    if previous is not None:
        original_header = parse_license_header(previous)
        # Check whether the license has changed
        if original_header and license_header != original_header:
            return LicenseHeaderError(
                "existing file has changed license", relpath, _replace_header(contents, original_header)
            )
        # If the original file didn't have a header and the current one doesn't either
        # we report as missing, but we can't suggest an automatic fix.
        elif not original_header and not license_header:
            return LicenseHeaderError("missing license header", relpath, None)
    # License is missing altogether
    elif not license_header:
        return LicenseHeaderError("missing license header", relpath, f"{get_default_license_header()}\n{contents}")
    # When it's a new file and a license header is found, compare it to the current header template
    elif license_header != get_default_license_header():
        return LicenseHeaderError(
            "file does not match expected license format",
            relpath,
            _replace_header(contents, get_default_license_header()),
        )