code: def _add_cls_kwarg(cls: Callable, kwargs: dict, key: str, value):
      """
      Adds arguments to the `kwargs` dictionary if the key-value pair is valid for the `cls` class signature.
      """
      if key in [
          p.name for p in inspect.signature(cls).parameters.values()
      ]:
          kwargs[key] = value
  
      return kwargs
  
file_path: lightwood/lightwood/helpers/templating.py
imports: from typing import Callable
  from collections import deque
  import inspect
  import numpy
  from type_infer.dtype import dtype
label_desc: Use image node_id 6 for calling a global function with example usage: _add_cls_kwarg(cls, kwargs, key, value) and returns: kwargs