2 from inputimeout
import inputimeout
, TimeoutOccurred
4 def query_yes_no(question
=''): #https://code.activestate.com/recipes/577058/
5 """Ask a yes/no question via raw_input() and return their answer.
6 "question" is a string that is presented to the user.
7 The "answer" return value is True for "yes" or False for "no".
9 valid
= {"yes": True, "y": True, "ye": True, "no": False, "n": False}
14 choice
= inputimeout(prompt
=question
, timeout
=5)
15 except TimeoutOccurred
:
16 sys
.stdout
.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n')")