code: def _recursive_install_subds_underneath(
      ds,
      recursion_limit,
      reckless,
      start=None,
      refds_path=None,
      description=None,
      jobs=None,
      producer_only=False,
  ):
      if isinstance(recursion_limit, int) and recursion_limit <= 0:
          return
      # install using helper that give some flexibility regarding where to
      # get the module from
  
      # Keep only paths, to not drag full instances of Datasets along,
      # they are cheap to instantiate
      sub_paths_considered = []
      subs_notneeded = []
  
      def gen_subs_to_install():  # producer
          for sub in ds.subdatasets(
              path=start,
              return_type="generator",
              result_renderer="disabled",
          ):
              sub_path = sub["path"]
              sub_paths_considered.append(sub_path)
              if (
                  sub.get("gitmodule_datalad-recursiveinstall", "")
                  == "skip"
              ):
                  lgr.debug(
                      "subdataset %s is configured to be skipped on recursive installation",
                      sub_path,
                  )
                  continue
              # TODO: Yarik is lost among all parentds, ds, start, refds_path so is not brave enough to
              # assume any from the record, thus will pass "ds.path" around to consumer
              yield ds.path, ReadOnlyDict(sub), recursion_limit
  
      def consumer(ds_path__sub__limit):
          ds_path, sub, recursion_limit = ds_path__sub__limit
          subds = Dataset(sub["path"])
          if sub.get("state", None) != "absent":
              rec = get_status_dict(
                  "install",
                  ds=subds,
                  status="notneeded",
                  logger=lgr,
                  refds=refds_path,
              )
              subs_notneeded.append(rec)
              yield rec
              # do not continue, even if an intermediate dataset exists it
              # does not imply that everything below it does too
          else:
              # TODO: here we need another "ds"!  is it within "sub"?
              yield from _install_subds_from_flexible_source(
                  Dataset(ds_path),
                  sub,
                  reckless=reckless,
                  description=description,
              )
  
          if not subds.is_installed():
              # an error result was emitted, and the external consumer can decide
              # what to do with it, but there is no point in recursing into
              # something that should be there, but isn't
              lgr.debug(
                  "Subdataset %s could not be installed, skipped", subds
              )
              return
  
          # recurse
          # we can skip the start expression, we know we are within
          for res in _recursive_install_subds_underneath(
              subds,
              recursion_limit=recursion_limit - 1
              if isinstance(recursion_limit, int)
              else recursion_limit,
              reckless=reckless,
              refds_path=refds_path,
              jobs=jobs,
              producer_only=True,  # we will be adding to producer queue
          ):
              producer_consumer.add_to_producer_queue(res)
  
      producer = gen_subs_to_install()
      if producer_only:
          yield from producer
      else:
          producer_consumer = ProducerConsumerProgressLog(
              producer,
              consumer,
              # no safe_to_consume= is needed since we are doing only at a single level ATM
              label="Installing",
              unit="datasets",
              jobs=jobs,
              lgr=lgr,
          )
          yield from producer_consumer
  
imports: import logging
  import re
  import os.path
  from datalad.config import ConfigManager
  from datalad.interface.base import Interface, eval_results
  from datalad.interface.base import build_doc
  from datalad.interface.results import get_status_dict, results_from_paths, annexjson2result, success_status_map, results_from_annex_noinfo
  from datalad.interface.common_opts import recursion_flag, location_description, jobs_opt, reckless_opt
  from datalad.interface.results import is_ok_dataset
  from datalad.support.constraints import EnsureInt, EnsureChoice, EnsureStr, EnsureNone
  from datalad.support.collections import ReadOnlyDict
  from datalad.support.param import Parameter
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.gitrepo import GitRepo, _fixup_submodule_dotgit_setup
  from datalad.support.exceptions import CapturedException, CommandError, InsufficientArgumentsError
  from datalad.support.network import URL, RI, urlquote
  from datalad.support.parallel import ProducerConsumerProgressLog
  from datalad.utils import unique, Path, get_dataset_root, shortened_repr
  from datalad.local.subdatasets import Subdatasets
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset
  from datalad.core.distributed.clone import clone_dataset
  from datalad.distribution.utils import _get_flexible_source_candidates
label_desc: Use image node_id 5 for calling a global function with example usage: _recursive_install_subds_underneath(ds, recursion_limit, reckless, start, refds_path, description, jobs, producer_only) without return types