code: def is_result_matching_pathsource_argument(
      res: dict[str, Any], **kwargs: Any
  ) -> bool:
      # we either have any non-zero number of "paths" (that could be anything), or
      # we have one path and one source
      # we don't do any error checking here, done by the command itself
      if res.get("action", None) not in ("install", "get"):
          # this filter is only used in install, reject anything that comes
          # in that could not possibly be a 'install'-like result
          # e.g. a sibling being added in the process
          return False
      source = kwargs.get("source", None)
      if source is not None:
          # we want to be able to deal with Dataset instances given as 'source':
          if isinstance(source, Dataset):
              source = source.path
          # if there was a source, it needs to be recorded in the result
          # otherwise this is not what we are looking for
          return source == res.get("source_url", None)
      # the only thing left is a potentially heterogeneous list of paths/URLs
      paths = ensure_list(kwargs.get("path", []))
      # three cases left:
      # 1. input arg was an absolute path -> must match 'path' property
      # 2. input arg was relative to a dataset -> must match refds/relpath
      # 3. something nifti with a relative input path that uses PWD as the
      #    reference
      respath = res.get("path", None)
      if respath in paths:
          # absolute match, pretty sure we want this
          return True
      elif (
          isinstance(kwargs.get("dataset", None), Dataset)
          and YieldRelativePaths()(res) in paths
      ):
          # command was called with a reference dataset, and a relative
          # path of a result matches in input argument -- not 100% exhaustive
          # test, but could be good enough
          return True
      elif any(robust_abspath(p) == respath for p in paths):
          # one absolutified input path matches the result path
          # I'd say: got for it!
          return True
      elif any(p == res.get("source_url", None) for p in paths):
          # this was installed from a URL that was given, we'll take that too
          return True
      else:
          return False
  
imports: from __future__ import annotations
  import logging
  from collections.abc import Iterable, Iterator
  from os.path import isabs, isdir
  from os.path import join
  from os.path import normpath, relpath
  from typing import Any, Optional
  from datalad.distribution.dataset import Dataset
  from datalad.support.exceptions import CapturedException, CommandError, format_oneline_tb
  from datalad.support.path import robust_abspath
  from datalad.utils import PurePosixPath, ensure_list, path_is_subpath
label_desc: Use image node_id 7 for calling a global function with example usage: is_result_matching_pathsource_argument(res) and returns: False, unknown, True, True, True, True, False