code: def get_result_filter(fx):
      """Wrap a filter into a helper to be able to accept additional
      arguments, if the filter doesn't support it already"""
      _fx = fx
      if fx and not getargspec(fx).keywords:
  
          def _fx(res, **kwargs):
              return fx(res)
  
      return _fx
  
imports: import logging
  import sys
  from time import time
  from os import listdir
  from os.path import join
  from os.path import isdir
  from os.path import relpath
  from os.path import sep
  import json
  from typing import TypeVar
  from datalad.utils import with_pathsep
  from datalad.utils import path_startswith, path_is_subpath, ensure_unicode, getargspec
  from datalad.support.gitrepo import GitRepo
  from datalad.support.exceptions import CapturedException
  from datalad import cfg
  from datalad.dochelpers import single_or_plural
  from datalad.ui import ui
  import datalad.support.ansi_colors
label_desc: Use image node_id 4 for calling a global function with example usage: get_result_filter(fx) and returns: _fx, fx