<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def add_based_on_time(files_with_tags, on_location):
    '''
    Sometimes the first photo in a series does not have gps coordinates because the phone
    doesnt have a gps-fix yet. To add these photos as well we take the list of photos wich where
    taken in the right location. Then add any photos taken whitin 10 minutes of these photos,
    because they are almost certainly taken in the same area.
    '''
    to_add = dict()
    for veiling_f, veiling_tags in on_location.items():
        for compare_f, compare_tags in files_with_tags.items():
            delta = abs(veiling_tags['TIME'] - compare_tags['TIME'])
            if (delta.total_seconds() < 10 * 60) and (compare_f not in on_location.keys()):
                to_add[compare_f] = compare_tags
    return to_add