def make_safe_f(f, allowed_params):
 def inner(*args, **kwargs):
  if kwargs:
   new_kwargs = {}
   for (k, v) in kwargs.items():
    if (k in allowed_params):
     new_kwargs[k] = v
   return f(*args, **new_kwargs)
  return f(*args, **kwargs)
 return inner

def make_safe_f ( f , allowed_params ) : def inner ( * args , ** kwargs ) : if kwargs : new_kwargs = { } for ( k , v ) in kwargs . items ( ) : if ( k in allowed_params ) : new_kwargs [ k ] = v return f ( * args , ** new_kwargs ) return f ( * args , ** kwargs ) return inner
make version of f that ignores extra named params .