#NEWLINE# def confirm_proceed( self , prompt ) : #NEWLINE# #INDENT# '\n        Prompts the user for yes/no confirmation to proceed.\n        ' #NEWLINE# locale_encoding = locale . getpreferredencoding ( ) #NEWLINE# old_stdout = sys . stdout #NEWLINE# sys . stdout = codecs . getwriter ( locale_encoding ) ( sys . stdout ) #NEWLINE# user_input = input ( prompt ) #NEWLINE# confirm = None #NEWLINE# while ( confirm is None ) : #NEWLINE# #INDENT# if ( user_input . lower ( ) in [ 'y' , 'yes' ] ) : #NEWLINE# #INDENT# confirm = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( user_input . lower ( ) in [ 'n' , 'no' ] ) : #NEWLINE# #INDENT# confirm = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# user_input = input ( "Invalid input. Please type 'yes', 'no', 'y' or 'n':\n" ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# sys . stdout = old_stdout #NEWLINE# return confirm