def METHOD_NAME(btpUsecase):
    accountMetadata = btpUsecase.accountMetadata
    if "createdServiceInstances" in accountMetadata:
        for service in accountMetadata["createdServiceInstances"]:
            if (
                service["name"] == "xsuaa"
                and service["plan"] == "apiaccess"
                and service["skipTrustSetupForXSUAA"] is False
            ):
                log.info("SETTING UP TRUST")
                log.header("SETTING UP TRUST")
                if "instancename" in service and "createdServiceKeys" in service:
                    accountMetadata = addKeyValuePair(
                        accountMetadata, "trustSetupXSUAA", []
                    )
                    for key in service["createdServiceKeys"]:
                        log.info("using XSUAA service key >" + key["keyname"] + "<")
                        if "payload" in key:
                            payload = key.get("payload").get("credentials")
                            authClientId = payload["clientid"]
                            authClientSecret = payload["clientsecret"]
                            log.info("get access token for XSUAA")
                            resultApiAccessToken = get_api_access_token_for_xsuaa(
                                btpUsecase,
                                payload["url"] + "/oauth/token",
                                authClientId,
                                authClientSecret,
                            )
                            accessToken = resultApiAccessToken["access_token"]
                            log.info(
                                "get list of IAS tenants that the subaccount has access to"
                            )
                            resultIasTenants = get_list_of_ias_tenants(
                                btpUsecase,
                                payload["apiurl"] + "/sap/rest/identity-providers/ias",
                                accessToken,
                            )
                            log.info("create own IDP")
                            resultOwnIDP = createOwnIDP(
                                btpUsecase,
                                payload["apiurl"] + "/sap/rest/identity-providers",
                                accessToken,
                                resultIasTenants,
                            )
                            item = {
                                "service_key": key["keyname"],
                                "tokenDetails": resultApiAccessToken,
                                "availableIasTenants": resultIasTenants,
                                "ownIDP": resultOwnIDP,
                            }
                            accountMetadata["trustSetupXSUAA"].append(item)
                    filename = btpUsecase.metadatafile
                    saveJsonToFile(filename, accountMetadata)
                else:
                    log.warning(
                        "couldn't execute trust flow, as instance name and/or service key for the XSUAA service was not found!"
                    )