I see that this was in the old code, so just some comments:

-It's redundant to write "if condition is True". "if condition" is enough.
- Also it's safer to do a if session.get("is_registered", False) in cases where is_registered is not in the session. Otherwise it bombs with an exception.