#NEWLINE# def init_once( self , func , tag ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# x = self . _init_once_cache [ tag ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# x = self . _init_once_cache . setdefault ( tag , ( False , allocate_lock ( ) ) ) #NEWLINE# #UNINDENT# if x [ 0 ] : #NEWLINE# #INDENT# return x [ 1 ] #NEWLINE# #UNINDENT# with x [ 1 ] : #NEWLINE# #INDENT# x = self . _init_once_cache [ tag ] #NEWLINE# if x [ 0 ] : #NEWLINE# #INDENT# return x [ 1 ] #NEWLINE# #UNINDENT# result = func ( ) #NEWLINE# self . _init_once_cache [ tag ] = ( True , result ) #NEWLINE# #UNINDENT# return result