def METHOD_NAME(
    *, whl_file: str, dest_dir: str, target_version: str, extra_globs: list[str] | None = None
) -> None:
    all_globs = ["*.dist-info/*", "*-nspkg.pth", *(extra_globs or ())]
    with temporary_dir() as workspace:
        # Extract the input.
        with open_zip(whl_file, "r") as whl:
            src_filenames = whl.namelist()
            whl.extractall(workspace)
        # Determine the location of the `dist-info` directory.
        dist_info_dir = locate_dist_info_dir(workspace)
        record_file = os.path.join(dist_info_dir, "RECORD")
        # Get version from the input whl's metadata.
        input_version = None
        metadata_file = os.path.join(workspace, dist_info_dir, "METADATA")
        with open(metadata_file, "r") as info:
            for line in info:
                mo = _version_re.match(line)
                if mo:
                    input_version = mo.group("version")
                    break
        if not input_version:
            raise Exception("Could not find `Version:` line in {}".format(metadata_file))
        # Rewrite and move all files (including the RECORD file), recording which files need to be
        # re-fingerprinted due to content changes.
        dst_filenames = []
        refingerprint = []
        for src_filename in src_filenames:
            if os.path.isdir(os.path.join(workspace, src_filename)):
                continue
            dst_filename = src_filename
            if any_match(all_globs, src_filename):
                rewritten = replace_in_file(workspace, src_filename, input_version, target_version)
                if rewritten is not None:
                    dst_filename = rewritten
                    refingerprint.append((src_filename, dst_filename))
            dst_filenames.append(dst_filename)
        # Refingerprint relevant entries in the RECORD file under their new names.
        rewrite_record_file(workspace, record_file, refingerprint)
        # Create a new output whl in the destination.
        dst_whl_filename = os.path.basename(whl_file).replace(input_version, target_version)
        dst_whl_file = os.path.join(dest_dir, dst_whl_filename)
        with tempfile.TemporaryDirectory() as chroot:
            tmp_whl_file = os.path.join(chroot, dst_whl_filename)
            with open_zip(tmp_whl_file, "w", zipfile.ZIP_DEFLATED) as whl:
                for dst_filename in dst_filenames:
                    whl.write(os.path.join(workspace, dst_filename), dst_filename)
            check_dst = os.path.join(chroot, "check-wheel")
            os.mkdir(check_dst)
            subprocess.run(args=["wheel", "unpack", "-d", check_dst, tmp_whl_file], check=True)
            shutil.move(tmp_whl_file, dst_whl_file)
        print("Wrote whl with version {} to {}.\n".format(target_version, dst_whl_file))