docs: def reset(ctx, force):
      """
      Reset all FIDO applications.
  
      This action will wipe all FIDO credentials, including FIDO U2F credentials,
      on the YubiKey and remove the PIN code.
  
      The reset must be triggered immediately after the YubiKey is
      inserted, and requires a touch on the YubiKey.
      """
  
      n_keys = len(list(get_descriptors()))
      if n_keys > 1:
          ctx.fail('Only one YubiKey can be connected to perform a reset.')
  
      if not force:
          if not click.confirm('WARNING! This will delete all FIDO credentials, '
                               'including FIDO U2F credentials, and restore '
                               'factory settings. Proceed?',
                               err=True):
              ctx.abort()
  
      def prompt_re_insert_key():
          click.echo('Remove and re-insert your YubiKey to perform the reset...')
  
          removed = False
          while True:
              sleep(0.1)
              n_keys = len(list(get_descriptors()))
              if not n_keys:
                  removed = True
              if removed and n_keys == 1:
                  return
  
      def try_reset(controller_type):
          if not force:
              prompt_re_insert_key()
              dev = list(get_descriptors())[0].open_device(TRANSPORT.FIDO)
              controller = controller_type(dev.driver)
              controller.reset(touch_callback=prompt_for_touch)
          else:
              controller = ctx.obj['controller']
              controller.reset(touch_callback=prompt_for_touch)
  
      if ctx.obj['dev'].is_fips:
          if not force:
              destroy_input = click.prompt(
                  'WARNING! This is a YubiKey FIPS device. This command will '
                  'also overwrite the U2F attestation key; this action cannot be '
                  'undone and this YubiKey will no longer be a FIPS compliant '
                  'device.\n'
                  'To proceed, please enter the text "OVERWRITE"',
                  default='',
                  show_default=False,
                  err=True
              )
              if destroy_input != 'OVERWRITE':
                  ctx.fail('Reset aborted by user.')
  
          try:
              try_reset(FipsU2fController)
  
          except ApduError as e:
              if e.code == SW.COMMAND_NOT_ALLOWED:
                  ctx.fail(
                      'Reset failed. Reset must be triggered within 5 seconds'
                      ' after the YubiKey is inserted.')
              else:
                  logger.error('Reset failed', exc_info=e)
                  ctx.fail('Reset failed.')
  
          except Exception as e:
              logger.error('Reset failed', exc_info=e)
              ctx.fail('Reset failed.')
  
      else:
          try:
              try_reset(Fido2Controller)
          except CtapError as e:
              if e.code == CtapError.ERR.ACTION_TIMEOUT:
                  ctx.fail(
                      'Reset failed. You need to touch your'
                      ' YubiKey to confirm the reset.')
              elif e.code == CtapError.ERR.NOT_ALLOWED:
                  ctx.fail(
                      'Reset failed. Reset must be triggered within 5 seconds'
                      ' after the YubiKey is inserted.')
              else:
                  logger.error(e)
                  ctx.fail('Reset failed.')
          except Exception as e:
              logger.error(e)
              ctx.fail('Reset failed.')