@gen.coroutine
def UpdateUser(client, obj_store, user_id, device_id, request):
  """Updates user profile and settings metadata."""
  password = request.pop('password', None)
  if password is not None:
    context = base.ViewfinderContext.current()

    user = context.user
    old_password = request.pop('old_password', None)

    # Recently confirmed cookies can always set the password -- this is how we do password resets.
    if not context.IsConfirmedUser():
      # Cookie is not confirmed, so raise an error unless one of the following is true:
      #   1. The old_password field is set and matches the user's current password.
      #   2. The user currently has no password. 
      if old_password is None and user.pwd_hash is not None:
        raise PermissionError(UPDATE_PWD_NOT_CONFIRMED)

      if user.pwd_hash is not None:
        yield password_util.ValidateUserPassword(client, user, old_password)

    # Replace password with generated hash and salt.
    pwd_hash, salt = password_util.GeneratePasswordHash(password)
    request['pwd_hash'] = pwd_hash
    request['salt'] = salt

  request = {'headers': request.pop('headers'),
             'user_dict': request,
             'settings_dict': request.pop('account_settings', None)}
  request['user_dict']['user_id'] = user_id

  yield gen.Task(Operation.CreateAndExecute,
                 client,
                 user_id,
                 device_id,
                 'User.UpdateOperation',
                 request)

  logging.info((user_id, device_id) % 'UPDATE USER: user: %d, device: %d')
  raise gen.Return({})
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/service.py/UpdateUser/swapped operands of `%`