def METHOD_NAME(cert, chain, key, alias, passphrase):
    certs_bytes = cert_chain_as_der(cert, chain)
    key_bytes = parse_private_key(key).private_bytes(
        encoding=serialization.Encoding.DER,
        format=serialization.PrivateFormat.PKCS8,
        encryption_algorithm=serialization.NoEncryption(),
    )
    entry = PrivateKeyEntry.new(alias, certs_bytes, key_bytes)
    return KeyStore.new("jks", [entry]).saves(passphrase)