def sync_before(f):
 @functools.wraps(f)
 def wrapper(self, *args, **kwargs):
  self._cell_data_sync()
  return f(self, *args, **kwargs)
 return wrapper

def sync_before ( f ) : @ functools . wraps ( f ) def wrapper ( self , * args , ** kwargs ) : self . _cell_data_sync ( ) return f ( self , * args , ** kwargs ) return wrapper
use as a decorator to wrap methods that use cell information to make sure they sync the latest information from the db periodically .