code: def filter_kwargs(dict_to_filter, function_to_call):
      """Utility to check which arguments in the passed dictionary exist in a function's signature
  
      The function returns two dicts, one with just the valid args from the input and one with the invalid args.
      The caller can then decide to ignore the existence of invalid args, depending on context.
      """
  
      sig = inspect.signature(function_to_call)
      filter_keys = [
          param.name
          for param in sig.parameters.values()
          if (param.kind == param.POSITIONAL_OR_KEYWORD)
      ]
      valid_args = {}
      invalid_args = {}
  
      for key in dict_to_filter:
          if key in filter_keys:
              valid_args[key] = dict_to_filter[key]
          else:
              invalid_args[key] = dict_to_filter[key]
      return valid_args, invalid_args
  
imports: import argparse
  from collections import OrderedDict
  from copy import deepcopy
  import logging
  import operator
  import random
  import numpy
  import torch
  import torch.nn
  import torch.backends.cudnn
  import yaml
  import inspect
label_desc: Use image node_id 49 for calling a global function with example usage: filter_kwargs(dict_to_filter, function_to_call) and returns: valid_args,  invalid_args