def task_exists(twarrior, task_name: str) -> bool:
    """
    Check if task exists before inserting it
    in Task Warrior.
    """
    tasks = twarrior.load_tasks()
    for key in tasks.keys():
        for task in tasks[key]:
            if task['description'] == task_name:
                return True
    return False