code: def confirm(prompt=None, resp=False):
      
      if prompt is None:
          prompt = 'Confirm'
  
      if resp:
          prompt = '%s [%s]|%s: ' % (prompt, 'y', 'n')
      else:
          prompt = '%s [%s]|%s: ' % (prompt, 'n', 'y')
  
      while True:
          ans = raw_input(prompt)
          if not ans:
              return resp
          if ans not in ['y', 'Y', 'n', 'N']:
              print 'please enter y or n.'
              continue
          if ans == 'y' or ans == 'Y':
              return True
          if ans == 'n' or ans == 'N':
              return False
docs: Prompts user for confirmation.
  
      :param prompt: String to display to user.
      :param resp: Default response value.
  
      :return: Boolean response from user, or default value.