code: def _get_names(
      entries: Iterable[Union["QueueEntry", "QueueDoneResult"]]
  ):
      names: List[str] = []
      for entry in entries:
          if isinstance(entry, QueueDoneResult):
              if entry.result and entry.result.ref_info:
                  names.append(entry.result.ref_info.name)
                  continue
              entry = entry.entry
          name = entry.name
          name = name or entry.stash_rev[:7]
          names.append(name)
      return names
  
imports: from typing import TYPE_CHECKING, Collection, Dict, Iterable, List, Set, Union
  from dvc.repo.experiments.exceptions import UnresolvedExpNamesError
  from dvc.repo.experiments.queue.base import QueueDoneResult
label_desc: Use image node_id 2 for calling a global function with example usage: _get_names(entries) and returns: names