def Synchronized(f):
 @functools.wraps(f)
 def NewFunction(self, *args, **kw):
  with self.lock:
   return f(self, *args, **kw)
 return NewFunction

def Synchronized ( f ) : @ functools . wraps ( f ) def NewFunction ( self , * args , ** kw ) : with self . lock : return f ( self , * args , ** kw ) return NewFunction
decorator to acquire a mutex around an apiproxystub method .