code: def confirm(
      text: str,
      default: t.Optional[bool] = False,
      abort: bool = False,
      prompt_suffix: str = ": ",
      show_default: bool = True,
      err: bool = False,
  ) -> bool:
      """Prompts for confirmation (yes/no question).
  
      If the user aborts the input by sending a interrupt signal this
      function will catch it and raise a :exc:`Abort` exception.
  
      :param text: the question to ask.
      :param default: The default value to use when no input is given. If
          ``None``, repeat until input is given.
      :param abort: if this is set to `True` a negative answer aborts the
                    exception by raising :exc:`Abort`.
      :param prompt_suffix: a suffix that should be added to the prompt.
      :param show_default: shows or hides the default value in the prompt.
      :param err: if set to true the file defaults to ``stderr`` instead of
                  ``stdout``, the same as with echo.
  
      .. versionchanged:: 8.0
          Repeat until input is given if ``default`` is ``None``.
  
      .. versionadded:: 4.0
          Added the ``err`` parameter.
      """
      prompt = _build_prompt(
          text,
          prompt_suffix,
          show_default,
          "y/n" if default is None else ("Y/n" if default else "y/N"),
      )
  
      while True:
          try:
              # Write the prompt separately so that we get nice
              # coloring through colorama on Windows
              echo(prompt.rstrip(" "), nl=False, err=err)
              # Echo a space to stdout to work around an issue where
              # readline causes backspace to clear the whole line.
              value = visible_prompt_func(" ").lower().strip()
          except (KeyboardInterrupt, EOFError):
              raise Abort() from None
          if value in ("y", "yes"):
              rv = True
          elif value in ("n", "no"):
              rv = False
          elif default is not None and value == "":
              rv = default
          else:
              echo(_("Error: invalid input"), err=err)
              continue
          break
      if abort and not rv:
          raise Abort()
      return rv
  
imports: import inspect
  import io
  import itertools
  import sys
  import typing
  from gettext import gettext
  from ._compat import isatty
  from ._compat import strip_ansi
  from .exceptions import Abort
  from .exceptions import UsageError
  from .globals import resolve_color_default
  from .types import Choice
  from .types import convert_type
  from .types import ParamType
  from .utils import echo
  from .utils import LazyFile
label_desc: Use image node_id 5 for calling a global function with example usage: confirm(text, default, abort, prompt_suffix, show_default, err) and returns: rv