Postgresql Function Set In Python Intersection Of Three