code: def filter_extra_accepted_kwargs(fun, kwargs, skip_positional=0):
      """
      Returns sub-dict of `kwargs` with the keys that match the
      names of arguments in `fun`'s signature.
      """
      sig = inspect.signature(fun)
      # the params from signature with up to skip_positional filtered out
      # (less only if there is not enough of positional args)
      params = [
          (name, param)
          for i, (name, param) in enumerate(sig.parameters.items())
          if i >= skip_positional
          or param.kind
          not in [
              inspect.Parameter.POSITIONAL_OR_KEYWORD,
              inspect.Parameter.POSITIONAL_ONLY,
          ]
      ]
      extra = [
          name
          for (name, param) in params
          if param.kind
          in [
              inspect.Parameter.POSITIONAL_OR_KEYWORD,
              inspect.Parameter.KEYWORD_ONLY,
          ]
      ]
      return {
          name: value for name, value in kwargs.items() if name in extra
      }
  
file_path: DALI/dali/python/nvidia/dali/auto_aug/core/_args.py
imports: import inspect
label_desc: Use image node_id 1 for calling a global function with example usage: filter_extra_accepted_kwargs(fun, kwargs, skip_positional) and returns: unknown