Prolog-style predicate logic for python