def invalid_args(func, argdict):
 (args, _, keywords, _) = inspect.getargspec(func)
 if keywords:
  return set()
 return (set(argdict) - set(args))

def invalid_args ( func , argdict ) : ( args , _ , keywords , _ ) = inspect . getargspec ( func ) if keywords : return set ( ) return ( set ( argdict ) - set ( args ) )
given a function and a dictionary of arguments .