python query checker