code: def _get_diff_indexes(
      out: "Output",
      local_index: Union["DataIndex", "DataIndexView"],
      remote_index: Union["DataIndex", "DataIndexView"],
  ) -> Tuple["DataIndex", "DataIndex"]:
      from dvc_data.index import DataIndex
  
      _, key = out.index_key
      old = DataIndex()
      new = DataIndex()
      for _, entry in local_index.iteritems(key):
          old.add(entry)
      for _, entry in remote_index.iteritems(key):
          new.add(entry)
  
      for prefix, storage in local_index.storage_map.items():
          old.storage_map[prefix] = storage
  
      for prefix, storage in remote_index.storage_map.items():
          new.storage_map[prefix] = storage
  
      return old, new
  
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 9 for calling a global function with example usage: _get_diff_indexes(out, local_index, remote_index) and returns: old,  new