code: def _fetch_out_changes(
      out: "Output",
      local_index: Union["DataIndex", "DataIndexView"],
      remote_index: Union["DataIndex", "DataIndexView"],
      remote: "Remote",
  ):
      from dvc.fs.callbacks import TqdmCallback
      from dvc_data.index.checkout import apply, compare
  
      old, new = _get_diff_indexes(out, local_index, remote_index)
  
      with TqdmCallback(
          unit="entry",
          desc="Comparing indexes",
      ) as cb:
          diff = compare(
              old,
              new,
              delete=True,
              meta_only=True,
              meta_cmp_key=partial(_meta_checksum, remote.fs),
              callback=cb,
          )
  
      total = len(new)
      with TqdmCallback(
          unit="file", desc=f"Updating '{out}'", disable=total == 0
      ) as cb:
          cb.set_size(total)
          apply(
              diff,
              out.repo.root_dir,
              out.fs,
              update_meta=False,
              storage="data",
              callback=cb,
          )
          out.save()
  
file_path: dvc/dvc/repo/worktree.py
imports: from functools import partial
  from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Tuple, Union
  from funcy import first
  from dvc.log import logger
  from dvc.stage.exceptions import StageUpdateError
label_desc: Use image node_id 8 for calling a global function with example usage: _fetch_out_changes(out, local_index, remote_index, remote) without return types