Solution
if 'user_available' in session and session['user_available']:
# The key is present in the session and the value is set.
if 'user_available' in session and session['user_available']:
# The key is present in the session and the value is set.