def Transform(self, client, activity, callback):
    from activity import Activity
    from asset_id import AssetIdUniquifier
    from device import Device

    def _OnUpdate(new_activity):
      """Delete the old activity."""
      if Version._mutate_items:
        activity.Delete(client, partial(callback, new_activity))
      else:
        callback(new_activity)

    timestamp, device_id, uniquifier = Activity.DeconstructActivityId(activity.activity_id)

    if device_id == Device.SYSTEM:
      if activity.activity_id in DisambiguateActivityIds2._unique_activity_ids:
        # Already saw this activity id, so append viewpoint id to it.
        assert uniquifier.server_id is None, (activity, uniquifier)
        new_uniquifier = AssetIdUniquifier(uniquifier.client_id, activity.viewpoint_id)
        new_activity_id = Activity.ConstructActivityId(timestamp, device_id, new_uniquifier)

        new_activity_dict = activity._asdict()
        new_activity_dict['activity_id'] = new_activity_id

        new_activity = Activity.CreateFromKeywords(**new_activity_dict)

        logging.info('%s\n%s (%s/%s/%s) => %s (%s/%s/%s/%s)' %
                     (activity, activity.activity_id, timestamp, device_id, uniquifier.client_id,
                      new_activity_id, timestamp, device_id, new_uniquifier.client_id, new_uniquifier.server_id))

        if Version._mutate_items:
          new_activity.Update(client, partial(_OnUpdate, new_activity))
        else:
          _OnUpdate(new_activity)
      else:
        DisambiguateActivityIds2._unique_activity_ids.add(activity.activity_id)
        callback(activity)
    else:
      assert DisambiguateActivityIds2._unique_activity_ids not in activity.activity_id, activity
      callback(activity)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/versions.py/DisambiguateActivityIds2.Transform/swapped operands of `not in`