#NEWLINE# def _save_and_block_module( name , orig_modules ) : #NEWLINE# #INDENT# 'Helper function to save and block a module in sys.modules\n\n    Return True if the module was in sys.modules, False otherwise.\n    ' #NEWLINE# saved = True #NEWLINE# try : #NEWLINE# #INDENT# orig_modules [ name ] = sys . modules [ name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# saved = False #NEWLINE# #UNINDENT# sys . modules [ name ] = None #NEWLINE# return saved