Logical programming for Python