def _upsert_users(cursor, user_ids, lookup_func):
user_ids = list(set(user_ids))  <EOL>cursor.execute("<STR_LIT>",<EOL>(user_ids,))<EOL>existing_user_ids = [x[<NUM_LIT:0>] for x in cursor.fetchall()]<EOL>new_user_ids = [u for u in user_ids if u not in existing_user_ids]<EOL>for user_id in existing_user_ids:<EOL><INDENT>user_info = lookup_func(user_id)<EOL>cursor.execute("""<STR_LIT>""", user_info)<EOL><DEDENT>for user_id in new_user_ids:<EOL><INDENT>user_info = lookup_func(user_id)<EOL>cursor.execute("""<STR_LIT>""", user_info)<EOL><DEDENT>
Upsert's user info into the database.
    The model contains the user info as part of the role values.