def classlock(f):
 def inner(self, *args, **kwargs):
  curframe = inspect.currentframe()
  calframe = inspect.getouterframes(curframe, 2)
  if calframe[1][1].endswith('database.py'):
   return f(self, *args, **kwargs)
  with self._lock:
   return f(self, *args, **kwargs)
 return inner

def classlock ( f ) : def inner ( self , * args , ** kwargs ) : curframe = inspect . currentframe ( ) calframe = inspect . getouterframes ( curframe , 2 ) if calframe [ 1 ] [ 1 ] . endswith ( 'database.py' ) : return f ( self , * args , ** kwargs ) with self . _lock : return f ( self , * args , ** kwargs ) return inner
classlock decorator .