def METHOD_NAME(tasks):
    """Calculate unused compute time"""
    all_tasks = list(itertools.chain.from_iterable(tasks.values()))
    start_time = min(task['started'] for task in all_tasks)
    end_time = max(task['completed'] for task in all_tasks)
    total_compute_time = sum(
        (datetime.timedelta(seconds=task['duration'])
         for task in all_tasks), datetime.timedelta())
    n_of_engines = len(tasks.keys())
    idle_time = n_of_engines * (end_time - start_time) - total_compute_time
    idle_perc = 100 * \
        (idle_time.total_seconds() / total_compute_time.total_seconds())
    return idle_time, idle_perc