code: def _get_remotes_having_commit(
      repo, commit_hexsha, with_urls_only=True
  ):
      """Traverse all branches of the remote and check if commit in any of their ancestry
  
      It is a generator yielding names of the remotes
      """
      remote_branches = [
          b["refname:strip=2"]
          for b in repo.for_each_ref_(
              fields="refname:strip=2",
              pattern="refs/remotes",
              contains=commit_hexsha,
          )
      ]
      return [
          remote
          for remote in repo.get_remotes(with_urls_only=with_urls_only)
          if any(rb.startswith(remote + "/") for rb in remote_branches)
      ]
  
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 1 for calling a global function with example usage: _get_remotes_having_commit(repo, commit_hexsha, with_urls_only) and returns: unknown