def statuses_resolve_uids(twitter, tl):
 user_ids = []
 for t in tl:
  rt = t.get('retweeted_status')
  if (rt and (not rt['user'].get('screen_name'))):
   user_ids.append(rt['user']['id'])
  if (not t['user'].get('screen_name')):
   user_ids.append(t['user']['id'])
 names = lookup(twitter, list(set(user_ids)))
 new_tl = []
 for t in tl:
  rt = t.get('retweeted_status')
  if (rt and (not rt['user'].get('screen_name'))):
   name = names[rt['user']['id']]
   t['retweeted_status']['user']['screen_name'] = name
  if (not t['user'].get('screen_name')):
   name = names[t['user']['id']]
   t['user']['screen_name'] = name
  new_tl.append(t)
 return new_tl

def statuses_resolve_uids ( twitter , tl ) : user_ids = [ ] for t in tl : rt = t . get ( 'retweeted_status' ) if ( rt and ( not rt [ 'user' ] . get ( 'screen_name' ) ) ) : user_ids . append ( rt [ 'user' ] [ 'id' ] ) if ( not t [ 'user' ] . get ( 'screen_name' ) ) : user_ids . append ( t [ 'user' ] [ 'id' ] ) names = lookup ( twitter , list ( set ( user_ids ) ) ) new_tl = [ ] for t in tl : rt = t . get ( 'retweeted_status' ) if ( rt and ( not rt [ 'user' ] . get ( 'screen_name' ) ) ) : name = names [ rt [ 'user' ] [ 'id' ] ] t [ 'retweeted_status' ] [ 'user' ] [ 'screen_name' ] = name if ( not t [ 'user' ] . get ( 'screen_name' ) ) : name = names [ t [ 'user' ] [ 'id' ] ] t [ 'user' ] [ 'screen_name' ] = name new_tl . append ( t ) return new_tl
resolve user ids to screen names from statuses .