docs: def export_public_key(device_type, args):
      """Generate a new pubkey for a new/existing GPG identity."""
      log.warning('NOTE: in order to re-generate the exact same GPG key later, '
                  'run this command with "--time=%d" commandline flag (to set '
                  'the timestamp of the GPG key manually).', args.time)
      c = client.Client(device=device_type())
      identity = client.create_identity(user_id=args.user_id,
                                        curve_name=args.ecdsa_curve)
      verifying_key = c.pubkey(identity=identity, ecdh=False)
      decryption_key = c.pubkey(identity=identity, ecdh=True)
      signer_func = functools.partial(c.sign, identity=identity)
  
      if args.subkey:  # add as subkey
          log.info('adding %s GPG subkey for "%s" to existing key',
                   args.ecdsa_curve, args.user_id)
          # subkey for signing
          signing_key = protocol.PublicKey(
              curve_name=args.ecdsa_curve, created=args.time,
              verifying_key=verifying_key, ecdh=False)
          # subkey for encryption
          encryption_key = protocol.PublicKey(
              curve_name=formats.get_ecdh_curve_name(args.ecdsa_curve),
              created=args.time, verifying_key=decryption_key, ecdh=True)
          primary_bytes = keyring.export_public_key(args.user_id)
          result = encode.create_subkey(primary_bytes=primary_bytes,
                                        subkey=signing_key,
                                        signer_func=signer_func)
          result = encode.create_subkey(primary_bytes=result,
                                        subkey=encryption_key,
                                        signer_func=signer_func)
      else:  # add as primary
          log.info('creating new %s GPG primary key for "%s"',
                   args.ecdsa_curve, args.user_id)
          # primary key for signing
          primary = protocol.PublicKey(
              curve_name=args.ecdsa_curve, created=args.time,
              verifying_key=verifying_key, ecdh=False)
          # subkey for encryption
          subkey = protocol.PublicKey(
              curve_name=formats.get_ecdh_curve_name(args.ecdsa_curve),
              created=args.time, verifying_key=decryption_key, ecdh=True)
  
          result = encode.create_primary(user_id=args.user_id,
                                         pubkey=primary,
                                         signer_func=signer_func)
          result = encode.create_subkey(primary_bytes=result,
                                        subkey=subkey,
                                        signer_func=signer_func)
  
      return protocol.armor(result, 'PUBLIC KEY BLOCK')