def with_backing_file(method):
 @with_backing_lock
 def wrapped_method(self, *args, **dargs):
  self._read_from_backing_file()
  try:
   return method(self, *args, **dargs)
  finally:
   self._write_to_backing_file()
 wrapped_method.__name__ = method.__name__
 wrapped_method.__doc__ = method.__doc__
 return wrapped_method

def with_backing_file ( method ) : @ with_backing_lock def wrapped_method ( self , * args , ** dargs ) : self . _read_from_backing_file ( ) try : return method ( self , * args , ** dargs ) finally : self . _write_to_backing_file ( ) wrapped_method . __name__ = method . __name__ wrapped_method . __doc__ = method . __doc__ return wrapped_method
a decorator to perform a lock-read-*-write-unlock cycle .