code: def _parse_git_submodules(ds, paths, cache):
      """All known ones with some properties"""
      ds_pathobj = ds.pathobj
      if not (ds_pathobj / ".gitmodules").exists():
          # easy way out. if there is no .gitmodules file
          # we cannot have (functional) subdatasets
          return
  
      if paths:
          paths_outside, paths_at_or_in = partition(
              paths,
              lambda p: ds_pathobj == p or ds_pathobj in p.parents,
          )
          paths = [p.relative_to(ds_pathobj) for p in paths_at_or_in]
          if not paths:
              if any(
                  p for p in paths_outside if p in ds_pathobj.parents
              ):
                  # The dataset is directly under some specified path, so include
                  # it.
                  paths = None
              else:
                  # we had path constraints, but none matched this dataset
                  return
      # can we use the reported as such, or do we need to recode wrt to the
      # query context dataset?
      cache["repo"] = repo = ds.repo
      if ds_pathobj == repo.pathobj:
          yield from repo.get_submodules_(paths=paths)
      else:
          for props in repo.get_submodules_(paths=paths):
              props["path"] = ds_pathobj / props["path"].relative_to(
                  repo.pathobj
              )
              yield props
  
imports: import logging
  import re
  import os
  import warnings
  from datalad.interface.utils import generic_result_renderer
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.results import get_status_dict
  from datalad.support.constraints import EnsureStr, EnsureNone, NoneDeprecated
  from datalad.support.param import Parameter
  from datalad.support.exceptions import CapturedException, CommandError
  from datalad.interface.common_opts import contains, dataset_state, fulfilled, recursion_flag, recursion_limit
  from datalad.distribution.dataset import Dataset, require_dataset
  from datalad.support.gitrepo import GitRepo
  from datalad.utils import ensure_list, getpwd, partition, Path
  from datalad.distribution.dataset import EnsureDataset, datasetmethod, resolve_path
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_git_submodules(ds, paths, cache) without return types