human
Complete the below
@gen.engine
def ComputeAppVersions(merged_store, filenames, callback):

    ''''Compute count of devices per version for each day. If a device is seen with different versions, count newest.'
    '''
assistant
#Here is Python program to compute count of devices per version for each day.
    def _ProcessOneEntry(entry, uuid_dict):
        timestamp = entry['timestamp']
        method = entry['method']
        req = entry['request']
        if (not req):
            return
        ddict = None
        if (method == 'ping'):
            ddict = req.get('device', None)
        else:
            assert (method in ('Device.UpdateOperation', 'User.RegisterOperation', 'RegisterUserOperation.Execute')), ('Unexpected    entry:    %r' % entry)
            ddict = req.get('device_dict', None)
        if (not ddict):
            return
        dev_uuid = ddict.get('device_uuid', None)
        if (not dev_uuid):
            return
        version = ddict.get('version', None)
        if ((not version) or version.endswith('.dev')):
            return
        name = ddict.get('name', None)
        if (name and (name == 'iPhone    Simulator')):
            return
        for k in ['platform', 'os', 'language', 'country']:
            val = ddict.get(k, None)
            if val:
                uuid_dict[dev_uuid][k] = val
        prev_version = uuid_dict[dev_uuid].get('version', None)
        if ((not prev_version) or (cmp(version.split('.'), prev_version.split('.')) > 0)):
            uuid_dict[dev_uuid]['version'] = version
    day_dict = defaultdict(list)
    for f in filenames:
        day_dict[f.split('/')[(-1)]].append(f)
    day_stats = defaultdict(DotDict)
    for day in sorted(day_dict.keys()):
        file_list = day_dict[day]
        uuid_dict = defaultdict(dict)
        for f in file_list:
            contents = (yield gen.Task(merged_store.Get, f))
            dev_list = json.loads(contents)
            for entry in dev_list:
                _ProcessOneEntry(entry, uuid_dict)
        def _CounterFromField(field):
            return Counter((x[field] for x in uuid_dict.values() if (field in x)))
        count_by_platform = _CounterFromField('platform')
        for (platform, count) in count_by_platform.iteritems():
            day_stats[day][('device_count.platform.%s' % platform.replace('.',...