parameters: (fname, kwargs, compat_args)
docstring: Checks whether 'kwargs' contains any keys that are not
      in 'compat_args' and raises a TypeError if there is one.
docstring_summary: Checks whether 'kwargs' contains any keys that are not
      in 'compat_args' and raises a TypeError if there is one.
docstring_tokens: Checks whether kwargs contains any keys that are not in compat_args and raises a TypeError if there is one .
function: def _check_for_invalid_keys(fname, kwargs, compat_args):
      """
      Checks whether 'kwargs' contains any keys that are not
      in 'compat_args' and raises a TypeError if there is one.
      """
      # set(dict) --> set of the dictionary's keys
      diff = set(kwargs) - set(compat_args)
  
      if diff:
          bad_arg = list(diff)[0]
          raise TypeError(f"{fname}() got an unexpected keyword argument '{bad_arg}'")
function_tokens: def _check_for_invalid_keys ( fname , kwargs , compat_args ) : # set(dict) --> set of the dictionary's keys diff = set ( kwargs ) - set ( compat_args ) if diff : bad_arg = list ( diff ) [ 0 ] raise TypeError ( f"{fname}() got an unexpected keyword argument '{bad_arg}'" )