def METHOD_NAME(self) -> KeySerializationEncryptionBuilder:
    if self not in (PrivateFormat.OpenSSH, PrivateFormat.PKCS12):
        raise ValueError(
            "encryption_builder only supported with PrivateFormat.OpenSSH"
            " and PrivateFormat.PKCS12"
        )
    return KeySerializationEncryptionBuilder(self)