

def find_or_create_ar(gplus_activity, activity_post):
    if (gplus_activity['verb'] == 'post'):
        original_post_id = gplus_activity['id']
    elif (gplus_activity['verb'] == 'share'):
        original_post_id = gplus_activity['object']['id']
    if (original_post_id is not None):
        records = ActivityRecord.query((ActivityRecord.gplus_posts == original_post_id)).fetch(20)
        if (len(records) == 0):
            return ar.create_activity_record(records)
        else:
            return records[0]
    return ar.create_activity_record(activity_post)

dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/services/update_gplus.py find_or_create_ar/VarMisuse@102/164 `activity_post`->`records`