Trying to logout side bar still showing

def logout(self):
“”“Logout the user by clearing session data and redirecting to the login page”“”
st.session_state.clear() # Clear all session data
st.session_state.page = ‘login’ # Set the page to ‘login’ after logout

    # Clear the sidebar and hide it
    st.sidebar.empty()  # Empty the sidebar to hide it
    st.write("You have been logged out.")

    # Rerun the app and go to the login page
    st.rerun()  # # Rerun the app to reset the session state