Removed unused imports
Fixed cmd line arguments helpers
Fixed serach query quoting in Python 2.6

Function 'query' needs native strings as parameters
in Python 2.6.
Removed unused import
Changed API for logging

New API follows API of standard logging module.
There are also some fixes for Python 2.6.
Overwrite traceback if some exists

I think the newest traceback is better choice than
first one.