code: def verify_and_update_password(password, user):
      
      if use_double_hash(user.password):
          verified = _pwd_context.verify(get_hmac(password), user.password)
      else:
          # Try with original password.
          verified = _pwd_context.verify(password, user.password)
  
      if verified and _pwd_context.needs_update(user.password):
          user.password = hash_password(password)
          _datastore.put(user)
      return verified
docs: Returns ``True`` if the password is valid for the specified user.
  
      Additionally, the hashed password in the database is updated if the
      hashing algorithm happens to have changed.
  
      :param password: A plaintext password to verify
      :param user: The user to verify against