def play_sound_if_needed(names, name_to_last_time_seen, cur_time, min_elapsed_to_play=3):
    for name in names:
        if ((name not in name_to_last_time_seen) or ((name_to_last_time_seen[name] + min_elapsed_to_play) < cur_time)):
            play_sound_for_name(name)
        name_to_last_time_seen[name] = cur_time
def play_sound_if_needed(names, name_to_last_time_seen, cur_time, min_elapsed_to_play=3):
    for name in names:
        if ((name not in name_to_last_time_seen) or ((name_to_last_time_seen[name] + min_elapsed_to_play) < cur_time)):
            play_sound_for_name(name)
        name_to_last_time_seen[name] = cur_time