def ynprompt(default=None, message=""):
	"""
	Ask a yes/no question.
	Returns True for yes, False for no.
	message is any text to show at the prompt.
	"""
	#handle defaults
	if default in ("y", "yes"):
		default=True
		prompt="[y]/n"
	elif default in ("n", "no"):
		default=False
		prompt="y/[n]"
	else:
		default=None
		prompt="y/n"
	#add a space for the message if present
	if message!="":
		message=f"{message} "
	#loop until a valid result is given
	while True:
		result_orig=input(f"{message}{prompt} > ")
		result=result_orig.lower().strip()
		#normal y/n + aliases
		if result in ("y", "yes"):
			return True
		elif result in ("n", "no"):
			return False
		#empty string with no default
		elif result=="" and default!=None:
			return default
		#show message, loop again
		print(f"error: could not understand '{result_orig}'!")
		print("Valid options are yes or no.")