def METHOD_NAME(privkey_pem: str, pubkey_pem: str) -> str:
    """
    Generate a x509 certificate from a key pair.
    Args:
        privkey_pem: The private key PEM.
        pubkey_pem: The public key PEM.
    Returns:
        The certificate PEM.
    """
    # Convert key pair
    privkey = crypto.load_privatekey(crypto.FILETYPE_PEM, privkey_pem)
    pubkey = crypto.load_publickey(crypto.FILETYPE_PEM, pubkey_pem)
    # New x509v3 certificate
    cert = crypto.X509()
    cert.set_version(0x2)
    # Serial number
    cert.set_serial_number(randint(1, 2 ** 64))
    # Before / After
    cert.gmtime_adj_notBefore(0)
    cert.gmtime_adj_notAfter(4 * (365 * 24 * 60 * 60))
    # Public key
    cert.set_pubkey(pubkey)
    # Subject name and issueer
    cert.get_subject().CN = "U2F emulated"
    cert.set_issuer(cert.get_subject())
    # Extensions
    cert.add_extensions([
        crypto.X509Extension(b"subjectKeyIdentifier",
                             False, b"hash", subject=cert),
    ])
    cert.add_extensions([
        crypto.X509Extension(b"authorityKeyIdentifier",
                             False, b"keyid:always", issuer=cert),
    ])
    cert.add_extensions([
        crypto.X509Extension(b"basicConstraints", True, b"CA:TRUE")
    ])
    # Signature
    cert.sign(privkey, 'sha256')
    return crypto.dump_certificate(crypto.FILETYPE_PEM, cert)