def handle_all_user_lookups(user_dicts_from_twitter, tweeters):
    dicts_by_screen_name = defaultdict(str)
    for user_dict in user_dicts_from_twitter:
        dicts_by_screen_name[user_dict["screen_name"].lower()] = user_dict

    i = 0
    for tweeter in tweeters:
        i += 1
        if tweeter.screen_name.lower() in dicts_by_screen_name.keys():
            user_dict = dicts_by_screen_name[tweeter.screen_name.lower()]
            tweeter.set_attributes_from_twitter_data(user_dict)
            # print i, "updated tweeter", tweeter, tweeter.last_collected_date
        else:
            tweeter.set_as_deleted()
        db.session.merge(tweeter)

    return True
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/tweeter.py/handle_all_user_lookups/original