#NEWLINE# def custom_import( self , name , globals = None , locals = None , fromlist = ( ) , level = 0 ) : #NEWLINE# #INDENT# if ( name in self . _allowed_modules ) : #NEWLINE# #INDENT# m = None #NEWLINE# if ( self . _allowed_modules [ name ] is None ) : #NEWLINE# #INDENT# m = importlib . import_module ( name ) #NEWLINE# self . _allowed_modules [ m ] = m #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# m = self . _allowed_modules [ name ] #NEWLINE# #UNINDENT# return m #NEWLINE# #UNINDENT# raise Exception ( "'{0}' is not configured as a supported import module" . format ( name ) )