def METHOD_NAME(
    is_active, is_staff, requesting_user, user_id
):
    """
    Raises an exception if the requesting_user is about to lock themselves out of
    the admin area of Baserow by either turning off their staff status or disabling
    their account.
    """
    is_setting_staff_to_false = is_staff is not None and not is_staff
    is_setting_active_to_false = is_active is not None and not is_active
    if user_id == requesting_user.id and (
        is_setting_staff_to_false or is_setting_active_to_false
    ):
        raise CannotDeactivateYourselfException()