Modified _query to work correctly with python3 json library