def Transform(self, client, member, callback):
    from episode import Episode
    from member import Member

    def _OnQueryMember(root_episode, sharer_member):
      assert Member.OWNED in sharer_member.labels, sharer_member

      logging.info('migrating share from user "%s" to user "%s" in episode "%s" in viewpoint "%s"' % \
                   (sharer_member.user_id, member.user_id, root_episode.episode_id,
                    root_episode.viewpoint_id))

      if Version._mutate_items:
        Episode._MigrateShare(client, root_episode, sharer_member=sharer_member,
                              recipient_member=member, add_photo_ids=None,
                              callback=partial(callback, member))
      else:
        callback(member)

    def _OnQueryEpisode(root_episode):
      Member.Query(client, root_episode.user_id, root_episode.episode_id, None,
                   partial(_OnQueryMember, root_episode))

    if member.sharing_user_id is None and Member.OWNED not in member.labels:
      assert list(member.labels) == [Member.SHARED], member
      Episode.Query(client, member.episode_id, None, _OnQueryEpisode)
    else:
      callback(member)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/versions.py/MigrateMoreShares.Transform/original