Instead of
if bla in [bla, blubb, bfoo]:
return True
return False
you can write: return bla in [bla, blubb, foo]