def METHOD_NAME():
    # Verify that the stack exists (create_resources has been ran before somewhere)
    stack_response = get_stack()
    if stack_response == "STACK_NOT_FOUND":
        raise Exception(
            f"CloudFormation stack \"{RESOURCE_STACK_NAME}\" not found.")
    elif stack_response["StackStatus"] != "CREATE_COMPLETE":
        print("Error: Stack was not successfully created. View the stack in the CloudFormation console here:")
        stack_link = convert_cf_arn_to_link(stack_response["StackId"])
        raise Exception(
            "Stack was not successfully created. View the stack in the CloudFormation console here:\n" + stack_link)
    else:
        credentials = iot.create_keys_and_certificate(setAsActive=True)
        iot.attach_policy(policyName="CF_FleetProvisioningDemoClaimPolicy",
                          target=credentials["certificateArn"])
        convert_pem_to_der(
            credentials["certificatePem"], credentials["keyPair"]["PrivateKey"])