@gen.coroutine
def GetUDIDTimestamps(merged_store, files):
 last_seen = {}
 for f in files:
  contents = (yield gen.Task(merged_store.Get, f))
  dev_list = json.loads(contents)
  for entry in dev_list:
   timestamp = entry['timestamp']
   device_dict = entry['request'].get('device', entry['request'].get('device_dict', None))
   if (not device_dict):
    continue
   udid = device_dict.get('test_udid', None)
   if (not udid):
    continue
   prev_seen = last_seen.get(udid, 0)
   if (timestamp > prev_seen):
    last_seen[udid] = timestamp
 raise gen.Return(last_seen)

@ gen . coroutine def GetUDIDTimestamps ( merged_store , files ) : last_seen = { } for f in files : contents = ( yield gen . Task ( merged_store . Get , f ) ) dev_list = json . loads ( contents ) for entry in dev_list : timestamp = entry [ 'timestamp' ] device_dict = entry [ 'request' ] . get ( 'device' , entry [ 'request' ] . get ( 'device_dict' , None ) ) if ( not device_dict ) : continue udid = device_dict . get ( 'test_udid' , None ) if ( not udid ) : continue prev_seen = last_seen . get ( udid , 0 ) if ( timestamp > prev_seen ) : last_seen [ udid ] = timestamp raise gen . Return ( last_seen )
iterate over all files and build a dict of udid -> last-seen-timestamp .