Run a group of tasks with a header, footer and success/failure messages.

    Args:
        header: A message to print in the header bar before the tasks are run.
        tasks: A list of tuples containing a task title, a task, and a weight.
            If the tuple only contains two values, the weight is assumed to be
            one.

def run_tasks(header, tasks):
    """Run a group of tasks with a header, footer and success/failure messages.

    Args:
        header: A message to print in the header bar before the tasks are run.
        tasks: A list of tuples containing a task title, a task, and a weight.
            If the tuple only contains two values, the weight is assumed to be
            one.
    """
    tasks = list(tasks)
    with timed_display(header) as print_message:
        with tqdm(tasks, position=1, desc='Progress', disable=None,
                  bar_format='{desc}{percentage:3.0f}% |{bar}|',
                  total=sum(t[2] if len(t) > 2 else 1 for t in tasks),
                  dynamic_ncols=True) as pbar:
            for task in tasks:
                print_message(task[0])
                with display_status():
                    try:
                        task[1]()
                    finally:
                        pbar.update(task[2] if len(task) > 2 else 1)