def find_or_create_ar(gplus_activity, activity_post):
    # is this a reshare find the first AR that references the post
    # if the post is shared query for the original post id
    # if there are none the create a new activity record and return it
    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(activity_post)
        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/operator `==` -> `!=`