def METHOD_NAME(vault_addr):
    vault_client = hvac.Client(url=f"https://{vault_addr}")
    recovery_keys = []
    if not vault_client.sys.is_initialized():
        init_response = vault_client.sys.initialize(
            secret_shares=key_shares,
            stored_shares=key_shares,
            recovery_shares=key_shares,
            recovery_threshold=recovery_threshold,
            recovery_pgp_keys=pgp_public_keys,
        )
        vault_root_token = init_response["root_token"]
        recovery_keys = init_response["recovery_keys"]
        vault_client.token = vault_root_token
        pulumi.log.info(
            "IMPORTANT!: Retain the keys in vault_recovery_keys.txt for "
            "recovering the cluster."
        )
        with open(  # noqa: PTH123
            "vault_recovery_keys.txt", "w"
        ) as vault_recovery_keys_file:  # noqa: PTH123, RUF100
            vault_recovery_keys_file.write("\n".join(recovery_keys))
        vault_ready = False
        while not vault_ready:
            try:
                pulumi.log.info(
                    "Trying to enable the userpass backend",
                    vault_client.sys.is_sealed(),
                )
                enabled_auths = vault_client.sys.list_auth_methods()
                if f"{PULUMI}/" not in enabled_auths:
                    vault_client.sys.enable_auth_method(
                        method_type="userpass",
                        description="Allow authentication for Pulumi using the "
                        "user/pass method",
                        path=PULUMI,
                    )
                vault_client.sys.create_or_update_policy(
                    name="cluster-admin",
                    policy=Path(__file__)
                    .resolve()
                    .parent.joinpath("pulumi_policy.hcl")
                    .read_text(),
                )
                user_pass = hvac.api.auth_methods.userpass.Userpass(
                    vault_client.adapter
                )
                user_pass.create_or_update_user(
                    username=pulumi_vault_creds["auth_username"],
                    password=pulumi_vault_creds["auth_password"],
                    mount_point=PULUMI,
                    policies=["cluster-admin", PULUMI],
                )
                vault_client.revoke_self_token()
                vault_ready = True
            except (hvac.exceptions.VaultDown, hvac.exceptions.InternalServerError):
                pulumi.log.info("Vault isn't ready yet. Waiting and trying again.")
                time.sleep(1)
    return recovery_keys