code: def _detect_nondead_annex_at_remotes(repo, annex_uuid):
      """Return list of remote names that know about a given (not-dead) annex
  
      This only uses the state of remotes known to the local remote state.
      No remote synchronization is performed.
  
      Parameters
      ----------
      repo: AnnexRepo or GitRepo
        Repository to evaluated
      annex_uuid: str
        UUID string of a particular annex
  
      Returns
      -------
      list
        Names of any matching remote, the local repository is indicated using
        a `None` label.
      """
      # build the refs for all remotes and local
      remotes_w_registration = []
      for remote in chain([""], repo.get_remotes()):
          refprefix = "{}{}git-annex:".format(
              remote,
              "/" if remote else "",
          )
          uuid_known = False
          try:
              for line in repo.call_git_items_(
                  ["cat-file", "-p", refprefix + "uuid.log"]
              ):
                  if line.startswith(annex_uuid):
                      # use None to label the local repo
                      uuid_known = True
                      break
          except CommandError as e:
              CapturedException(e)
              # this is not a problem per-se, logged above, just continue
              continue
          if not uuid_known:
              # if an annex id is not even in the uuid.log, we can stop here
              # (for this remote)
              continue
  
          # annex is known, but maybe is declared dead already, must check
          # trust.log in addition
          try:
              for line in repo.call_git_items_(
                  ["cat-file", "-p", refprefix + "trust.log"]
              ):
                  columns = line.split()
                  if columns[0] == annex_uuid:
                      # not known if dead
                      uuid_known = False if columns[1] == "X" else True
                      break
          except CommandError as e:
              CapturedException(e)
              # this is not a problem per-se, logged above, just continue
              continue
          finally:
              if uuid_known:
                  remotes_w_registration.append(remote or None)
      return remotes_w_registration
  
imports: import logging
  from itertools import chain
  import warnings
  from datalad.core.local.status import get_paths_by_ds
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import jobs_opt, recursion_flag, recursion_limit
  from datalad.interface.results import annexjson2result, results_from_annex_noinfo, success_status_map
  from datalad.runner.exception import CommandError
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.constraints import EnsureChoice, EnsureNone, EnsureStr
  from datalad.support.exceptions import CapturedException
  from datalad.support.param import Parameter
  from datalad.utils import ensure_list, rmtree
label_desc: Use image node_id 6 for calling a global function with example usage: _detect_nondead_annex_at_remotes(repo, annex_uuid) and returns: remotes_w_registration