code: def _yield_paths_by_ds(refds, dataset_arg, paths):
      """Status-internal helper to yield get_paths_by_ds() items"""
      paths_by_ds, errors = get_paths_by_ds(refds, dataset_arg, paths)
      # communicate all the problems
      for e in errors:
          yield dict(
              path=str(e),
              action="status",
              refds=refds.path,
              status="error",
              message=(
                  "path not underneath the reference dataset %s",
                  refds.path,
              ),
              logger=lgr,
          )
  
      while paths_by_ds:
          # gh-6566 advised replacement of OrderedDicts with dicts for performance
          # The previous qdspath, qpaths = paths_by_ds.popitem(last=False) used an
          # OrderedDict specific function (returns k, v in FIFO order). Below is a
          # less pretty replacement for this functionality with a pure dict
          qdspath = next(iter(paths_by_ds.keys()))
          qpaths = paths_by_ds.pop(qdspath)
          if qpaths and qdspath in qpaths:
              # this is supposed to be a full status query, save some
              # cycles sifting through the actual path arguments
              qpaths = []
          yield dict(ds=Dataset(qdspath), paths=qpaths)
  
imports: import logging
  import os
  import os.path
  from collections import OrderedDict
  import warnings
  from datalad.utils import bytes2human, ensure_list, ensure_unicode, get_dataset_root
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import recursion_limit, recursion_flag
  from datalad.interface.utils import generic_result_renderer
  import datalad.support.ansi_colors
  from datalad.support.param import Parameter
  from datalad.support.constraints import EnsureChoice, EnsureNone, EnsureStr
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset, resolve_path, path_under_rev_dataset
  import datalad.utils
  from datalad.dochelpers import single_or_plural
label_desc: Use image node_id 3 for calling a global function with example usage: _yield_paths_by_ds(refds, dataset_arg, paths) without return types