functions type() returns the type of something

Instead of nesting if statements to check for state, you can try this if data not in [role1, role2]

misc Python Debugger Django