code: def import_key(
          ctx, slot, management_key, pin, private_key,
          pin_policy, touch_policy, password):
      
      dev = ctx.obj['dev']
      controller = ctx.obj['controller']
      _ensure_authenticated(ctx, controller, pin, management_key)
  
      data = private_key.read()
  
      while True:
          if password is not None:
              password = password.encode()
          try:
              private_key = parse_private_key(data, password)
          except (ValueError, TypeError):
              if password is None:
                  password = click.prompt(
                      'Enter password to decrypt key',
                      default='', hide_input=True,
                      show_default=False,
                      err=True)
                  continue
              else:
                  password = None
                  click.echo('Wrong password.')
              continue
          break
  
      if pin_policy:
          pin_policy = PIN_POLICY.from_string(pin_policy)
      if touch_policy:
          touch_policy = TOUCH_POLICY.from_string(touch_policy)
  
      _check_pin_policy(ctx, dev, controller, pin_policy)
      _check_touch_policy(ctx, controller, touch_policy)
      _check_key_size(ctx, controller, private_key)
  
      controller.import_key(
              slot,
              private_key,
              pin_policy,
              touch_policy)
docs: Import a private key.
  
      Write a private key to one of the slots on the YubiKey.
  
      \b
      SLOT        PIV slot to import the private key to.
      PRIVATE-KEY File containing the private key. Use '-' to use stdin.