Implement new query command in python.