@gen.engine
  def Transform(self, client, device_photo, callback):
    from device import Device
    from user_photo import UserPhoto
    device_id = device_photo.device_id

    if MoveDevicePhoto._device_to_user_cache not in device_id:
      query_expr = ('device.device_id={t}', {'t': device_id})
      devices = yield gen.Task(Device.IndexQuery, client, query_expr, None)
      assert len(devices) == 1
      MoveDevicePhoto._device_to_user_cache[device_id] = devices[0].user_id
    user_id = MoveDevicePhoto._device_to_user_cache[device_id]

    existing = yield gen.Task(UserPhoto.Query, client, user_id, device_photo.photo_id, None, must_exist=False)
    if existing is None:
      logging.info('Creating user photo for photo %s, device %s, user %s', device_photo.photo_id, device_id, user_id)
      user_photo = UserPhoto.CreateFromKeywords(photo_id=device_photo.photo_id,
                                                user_id=user_id,
                                                asset_keys=device_photo.asset_keys)
    else:
      logging.info('Photo %s, device %s, user %s already has user photo', device_photo.photo_id, device_id, user_id)
      user_photo = None

    if user_photo is not None:
      self._LogUpdate(user_photo)

    if Version._mutate_items and user_photo is not None:
      yield gen.Task(user_photo.Update, client)

    callback(device_photo)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/versions.py/MoveDevicePhoto.Transform/swapped operands of `not in`