code: def _inherit_config_var(ds, cfgvar, var):
      if var is None:
          var = ds.config.get(cfgvar)
          if var:
              lgr.info("Inherited publish_depends from %s: %s", ds, var)
      return var
  
imports: import logging
  import os
  import os.path
  from urllib.parse import urlparse
  import datalad.support.ansi_colors
  from datalad.distribution.dataset import Dataset, require_dataset
  from datalad.distribution.update import Update
  from datalad.downloaders.credentials import UserPassword
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import annex_group_opt, annex_groupwanted_opt, annex_required_opt, annex_wanted_opt, as_common_datasrc, inherit_opt, location_description, publish_by_default, publish_depends, recursion_flag, recursion_limit
  from datalad.interface.results import get_status_dict
  from datalad.interface.utils import generic_result_renderer
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.constraints import EnsureBool, EnsureChoice, EnsureNone, EnsureStr
  from datalad.support.exceptions import AccessDeniedError, AccessFailedError, CapturedException, CommandError, DownloadError, InsufficientArgumentsError, RemoteNotAvailableError
  from datalad.support.gitrepo import GitRepo
  from datalad.support.network import RI, URL, PathRI
  from datalad.support.param import Parameter
  from datalad.utils import Path, ensure_list, slash_join
  from .dataset import EnsureDataset, datasetmethod
label_desc: Use image node_id 8 for calling a global function with example usage: _inherit_config_var(ds, cfgvar, var) and returns: var