def task_by_name(tasks, name):
    """ Find mesos task by its name
    """
    for task in tasks:
        if task['name'] == name:
            return task

    assert False, "Did not find task with name %s in this list of tasks: %s" % (name, tasks,)