working query.py with example