code: def ask(question, answer=str, default=None, length=None):
      if answer == str:
          r = ""
          while True:
              if default:
                  r = input(f"> {question} [{default}] ")
              else:
                  r = input(f"> {question} ")
  
              r = r.strip()
  
              if len(r) <= 0:
                  if default:
                      r = default
                      break
                  else:
                      print("You must enter something")
              else:
                  if length and len(r) != length:
                      print(f"Entry must be {length} characters long")
                  else:
                      break
  
          return r
  
      elif answer == bool:
          r = None
          while True:
              if default is True:
                  r = input(f"> {question} (Y/n) ")
              elif default is False:
                  r = input(f"> {question} (y/N) ")
              else:
                  r = input(f"> {question} (y/n) ")
  
              r = r.strip().lower()
  
              if r in ("y", "yes"):
                  r = True
                  break
              elif r in ("n", "no"):
                  r = False
                  break
              elif not r:
                  r = default
                  break
              else:
                  print("You must answer 'yes' or 'no'")
          return r
      elif answer == int:
          r = None
          while True:
              if default:
                  r = input(f"> {question} [{default}] ")
              else:
                  r = input(f"> {question} ")
  
              r = r.strip()
  
              if not r:
                  r = default
                  break
  
              try:
                  r = int(r)
                  break
              except ValueError:
                  print("You must enter an integer")
          return r
      else:
          raise NotImplementedError(
              "Argument `answer` must be str, bool, or integer"
          )
  
file_path: pelican/pelican/tools/pelican_quickstart.py
imports: import argparse
  import locale
  import os
  from typing import Mapping
  from jinja2 import Environment, FileSystemLoader
  from pelican import __version__
label_desc: Use image node_id 1 for calling a global function with example usage: ask(question, answer, default, length) and returns: r, r, r