code: def query_yes_no(question, default="yes"):
      """Ask a yes/no question via input() and return their answer.
  
      "question" is a string that is presented to the user.
      "default" is the presumed answer if the user just hits <Enter>.
          It must be "yes" (the default), "no" or None (meaning
          an answer is required of the user).
  
      The "answer" return value is one of "yes" or "no".
      """
      valid = {
          "yes": "yes",
          "y": "yes",
          "ye": "yes",
          "no": "no",
          "n": "no",
      }
      if default == None:
          prompt = " [y/n] "
      elif default == "yes":
          prompt = " [Y/n] "
      elif default == "no":
          prompt = " [y/N] "
      else:
          raise ValueError("invalid default answer: '%s'" % default)
  
      while 1:
          sys.stdout.write(question + prompt)
          choice = input().lower()
          if default is not None and choice == "":
              return default
          elif choice in valid.keys():
              return valid[choice]
          else:
              sys.stdout.write(
                  "Please respond with 'yes' or 'no' "
                  "(or 'y' or 'n').\n"
              )
  
imports: import sys
  import os
  from os.path import exists, basename, splitext
  import re
  import codecs
  import logging
  import optparse
  import json
label_desc: Use image node_id 9 for calling a global function with example usage: query_yes_no(question, default) and returns: default, valid