def _upsert_persons(cursor, person_ids, lookup_func):
person_ids = list(set(person_ids))  <EOL>cursor.execute("<STR_LIT>",<EOL>(person_ids,))<EOL>existing_person_ids = [x[<NUM_LIT:0>] for x in cursor.fetchall()]<EOL>new_person_ids = [p for p in person_ids if p not in existing_person_ids]<EOL>for person_id in existing_person_ids:<EOL><INDENT>person_info = lookup_func(person_id)<EOL>cursor.execute("""<STR_LIT>""", person_info)<EOL><DEDENT>for person_id in new_person_ids:<EOL><INDENT>person_info = lookup_func(person_id)<EOL>cursor.execute("""<STR_LIT>""", person_info)<EOL><DEDENT>
Upsert's user info into the database.
    The model contains the user info as part of the role values.