Interesting. IIRC I came across a series of libs from that family recently - for different languages, including Python. Need to check it out. Update: Googled, it's right here:
"There are implementations of miniKanren in Haskell, Racket, Ruby, Clojure, and Python. The canonical implementation is an embedded language in Scheme. The Clojure core.logic library was inspired by miniKanren."
The name kanren comes from a Japanese word for "relation".