pythonize ands and ors