code: def get_valid_kwargs(func, potential_kwargs):
      
      kwargs = {}
      for name in get_kwarg_names(func):
          with suppress(KeyError):
              kwargs[name] = potential_kwargs[name]
      return kwargs
docs: Return valid kwargs to function func