code: def ask_yes_no(prompt, default=None, interrupt=None):
      """Asks a question and returns a boolean (y/n) answer.
  
      If default is given (one of 'y','n'), it is used if the user input is
      empty. If interrupt is given (one of 'y','n'), it is used if the user
      presses Ctrl-C. Otherwise the question is repeated until an answer is
      given.
  
      An EOF is treated as the default answer.  If there is no default, an
      exception is raised to prevent infinite loops.
  
      Valid answers are: y/yes/n/no (match is not case sensitive)."""
  
      answers = {"y": True, "n": False, "yes": True, "no": False}
      ans = None
      while ans not in answers.keys():
          try:
              ans = input(prompt + " ").lower()
              if not ans:  # response was an empty string
                  ans = default
          except KeyboardInterrupt:
              if interrupt:
                  ans = interrupt
              print("\r")
          except EOFError:
              if default in answers.keys():
                  ans = default
                  print()
              else:
                  raise
  
      return answers[ans]
  
file_path: catboost/contrib/python/ipython/py3/IPython/utils/io.py
imports: import atexit
  import os
  import sys
  import tempfile
  from pathlib import Path
  from warnings import warn
  from IPython.utils.decorators import undoc
  from .capture import CapturedIO, capture_output
label_desc: Use image node_id 1 for calling a global function with example usage: ask_yes_no(prompt, default, interrupt) and returns: answers