def update_if_changed(self, entity, post):
        """Find out if the post has more +1 or reshares."""
        changed = False

        if entity.plus_oners != post['object']['plusoners']['totalItems']:
            changed = True
            entity.plus_oners = post['object']['plusoners']['totalItems']

        if entity.resharers != post['object']['resharers']['totalItems']:
            changed = True
            entity.resharers = post['object']['resharers']['totalItems']

        if entity.comments != post['object']['replies']['totalItems']:
            changed = True
            entity.comments = post['object']['replies']['totalItems']

        content = post['object']['content']
        if 'annotation' in post:
            content += ' ' + post['annotation']

        prod_group = entity.get_product_groups(content)
        act_type = entity.get_activity_types(content)

        if sorted(entity.product_group) != sorted(prod_group):
            changed = True
            entity.product_group = prod_group

        if sorted(entity.activity_type) != sorted(act_type):
            changed = True
            entity.activity_type = act_type

        if changed:
            return entity
        else:
            return None
dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/services/update_gplus.py/TaskUpdateGplus.update_if_changed/original