code: def _yield_specs(specs):
      if specs == "-":
          specs_it = sys.stdin
      elif isinstance(specs, (list, tuple)):
          specs_it = specs
      else:
          specs_it = Path(specs).open("r")
  
      for spec in specs_it:
          if isinstance(spec, (list, tuple)):
              src = spec[0]
              dest = spec[1]
          elif isinstance(spec, Path):
              src = spec
              dest = None
          else:
              # deal with trailing newlines and such
              spec = spec.rstrip()
              spec = spec.split("\0")
              src = spec[0]
              dest = None if len(spec) == 1 else spec[1]
          yield src, dest
  
imports: import logging
  import os.path
  from shutil import copyfile
  import sys
  from datalad.interface.base import Interface
  from datalad.interface.base import build_doc, eval_results
  from datalad.support.constraints import EnsureStr, EnsureNone
  from datalad.interface.common_opts import save_message_opt
  from datalad.support.param import Parameter
  from datalad.distribution.dataset import Dataset, require_dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CapturedException
  from datalad.utils import ensure_list, get_dataset_root, Path
  from datalad.distribution.dataset import EnsureDataset, datasetmethod, resolve_path
  from functools import lru_cache
label_desc: Use image node_id 1 for calling a global function with example usage: _yield_specs(specs) without return types