def idle_time(boutlist, idle_threshold=15):
    """Takes list of times of bouts in seconds, returns idle time in seconds, 
    i.e. time spent without bout for longer than idle_threshold in seconds.
    """
    idle_time = 0
    for i in range(0, len(boutlist) - 2):
        inter_bout_time = boutlist[i + 1] - boutlist[i]
        if inter_bout_time > idle_threshold:
            idle_time += inter_bout_time
    return idle_time