def LocalContext(function):
 @functools.wraps(function)
 def setter(*a, **kw):
  if (not kw):
   return function(*a)
  with context.local(**{k: kw.pop(k) for (k, v) in kw.items() if isinstance(getattr(ContextType, k, None), property)}):
   return function(*a, **kw)
 return setter

def LocalContext ( function ) : @ functools . wraps ( function ) def setter ( * a , ** kw ) : if ( not kw ) : return function ( * a ) with context . local ( ** { k : kw . pop ( k ) for ( k , v ) in kw . items ( ) if isinstance ( getattr ( ContextType , k , None ) , property ) } ) : return function ( * a , ** kw ) return setter
wraps the specified function on a context .