code: def configure_origins(cfgds, probeds, label=None, remote="origin"):
      """Configure any discoverable local dataset sibling as a remote
  
      Parameters
      ----------
      cfgds : Dataset
        Dataset to receive the remote configurations
      probeds : Dataset
        Dataset to start looking for `remote` remotes. May be identical with
        `cfgds`.
      label : int, optional
        Each discovered remote will be configured as a remote under the name
        '<remote>-<label>'. If no label is given, '2' will be used by default,
        given that there is typically a remote named `remote` already.
      remote : str, optional
        Name of the default remote on clone.
      """
      if label is None:
          label = 1
      # let's look at the URL for that remote and see if it is a local
      # dataset
      origin_url = probeds.config.get(f"remote.{remote}.url")
      if not origin_url:
          # no remote with default name, nothing to do
          return
      if not cfgds.config.obtain(
          "datalad.install.inherit-local-origin", default=True
      ):
          # no inheritance wanted
          return
      if not isinstance(RI(origin_url), PathRI):
          # not local path
          return
  
      # no need to reconfigure original/direct remote again
      if cfgds != probeds:
          # prevent duplicates
          known_remote_urls = set(
              cfgds.config.get(r + ".url", None)
              for r in cfgds.config.sections()
              if r.startswith("remote.")
          )
          if origin_url not in known_remote_urls:
              yield from cfgds.siblings(
                  "configure",
                  # no chance for conflict, can only be the second configured
                  # remote
                  name="{}-{}".format(remote, label),
                  url=origin_url,
                  # fetch to get all annex info
                  fetch=True,
                  result_renderer="disabled",
                  on_failure="ignore",
              )
      # and dive deeper
      # given the clone source is a local dataset, we can have a
      # cheap look at it, and configure its own `remote` as a remote
      # (if there is any), and benefit from additional annex availability
      yield from configure_origins(
          cfgds,
          Dataset(probeds.pathobj / origin_url),
          label=label + 1,
          remote=remote,
      )
  
imports: import logging
  from argparse import REMAINDER
  from typing import Dict
  from datalad.cmd import CommandError
  from datalad.config import ConfigManager
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset, resolve_path
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import location_description, reckless_opt
  from datalad.interface.results import get_status_dict
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.constraints import EnsureKeyChoice, EnsureNone, EnsureStr
  from datalad.support.exceptions import CapturedException
  from datalad.support.network import RI, PathRI
  from datalad.support.param import Parameter
  from datalad.utils import knows_annex, PurePath, rmtree
  from .clone_utils import _check_autoenable_special_remotes, _format_clone_errors, _generate_candidate_clone_sources, _get_remote, _get_tracking_source, _map_urls, _test_existing_clone_target, _try_clone_candidates, decode_source_spec, postclone_preannex_cfg_ria, postclonecfg_ria
label_desc: Use image node_id 10 for calling a global function with example usage: configure_origins(cfgds, probeds, label, remote) without return types