def migrate_project_contributed(user):
    count = 0
    for node_id in user.contributed:
        node = Node.load(node_id)
        if node._primary_key in user.unclaimed_records:
            del user.unclaimed_records[node._primary_key]

        node.contributors.remove(user._id)

        node.clear_permission(user)
        if user._id in node.visible_contributor_ids:
            node.visible_contributor_ids.remove(user._id)

        node.save()
        count += 1
        logger.info('Removed user - {} as a contributor from project - {}'.format(user._id, node._id))
    logger.info('Removed user - {} as a contributor from {} projects'.format(user._id, count))
dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/migrate_presentation_service.py/migrate_project_contributed/original