def METHOD_NAME(
    self,
    requesting_user: User,
    user_id: int,
    username: Optional[str] = None,
    name: Optional[str] = None,
    password: Optional[str] = None,
    is_active: Optional[bool] = None,
    is_staff: Optional[bool] = None,
):
    """
    Updates a specified user with new attribute values. Will raise an exception
    if a user attempts to de-activate or un-staff themselves.
    :param requesting_user: The user who is making the request to update a user, the
        user must be a staff member or else an exception will
        be raised.
    :param user_id: The id of the user to update, if they do not exist raises a
        UserDoesNotExistException.
    :param is_staff: Optional value used to set if the user is an admin or not.
    :param is_active: Optional value to disable or enable login for the user.
    :param password: Optional new password to securely set for the user.
    :param name: Optional new name to set on the user.
    :param username: Optional new username/email to set for the user.
    :raises PasswordDoesNotMatchValidation: When the provided password value is not
        a valid password.
    """
    LicenseHandler.raise_if_user_doesnt_have_feature_instance_wide(
        PREMIUM, requesting_user
    )
    self._raise_if_not_permitted(requesting_user)
    self._raise_if_locking_self_out_of_admin(
        is_active, is_staff, requesting_user, user_id
    )
    try:
        user = User.objects.select_for_update(of=("self",)).get(id=user_id)
    except User.DoesNotExist:
        raise UserDoesNotExistException()
    if is_staff is not None:
        user.is_staff = is_staff
    if is_active is not None:
        user.is_active = is_active
    if password is not None:
        try:
            validate_password(password, user)
        except ValidationError as e:
            raise PasswordDoesNotMatchValidation(e.messages)
        user.set_password(password)
    if name is not None:
        user.first_name = name
    if username is not None:
        user.email = username
        user.username = username
    user.save()
    return user