port the dict queries processing to python2.6

* method viewkeys() not available in python2.6
* instead we iterate now with simple for-loop over queries dict