code: def get_kwargs_for_func(
      func: Callable, kwargs: dict[str, Any]
  ) -> dict[str, Any]:
      """
      Get the set of keyword arguments from ``kwargs`` that are used by ``func``.
      Useful when calling a func from another func and inferring its signature
      from provided ``**kwargs``.
      """
      if not kwargs:
          return {}
  
      func_params = {
          name
          for name, param in inspect.signature(func).parameters.items()
          if param.kind in _KW_PARAM_KINDS
      }
      func_kwargs = {
          kwarg: value
          for kwarg, value in kwargs.items()
          if kwarg in func_params
      }
      return func_kwargs
  
imports: from __future__ import annotations
  import inspect
  import logging
  import pathlib
  import sys
  import warnings
  from typing import Any, Callable, Collection, Iterable, Literal, Optional, Type, Union, cast
  from .None import errors
  from .None import types
label_desc: Use image node_id 14 for calling a global function with example usage: get_kwargs_for_func(func, kwargs) and returns: func_kwargs, dict