def create_stack(
    cfn_client,
    template_path,
    stack_name,
    params={},
    capabilities=[],
    timeout=300,
    interval=30,
):
    """
    Creates a cloudformation stack from a cloudformation template
    """

    with open(template_path) as file:
        body = file.read()

    stack_params = [
        {"ParameterKey": key, "ParameterValue": value, "UsePreviousValue": False}
        for key, value in params.items()
    ]

    resp = cfn_client.create_stack(
        StackName=stack_name,
        TemplateBody=body,
        Parameters=stack_params,
        Capabilities=capabilities,
    )

    stack_id = resp["StackId"]

    print(f"Creating stack {stack_name}, waiting for stack create complete")
    waiter = cfn_client.get_waiter("stack_create_complete")
    waiter.wait(
        StackName=stack_name,
        WaiterConfig={"Delay": interval, "MaxAttempts": timeout // interval + 1},
    )

    return stack_name, stack_id