Exceptions handling, python-style fixes, PEP8 fixes, SELECT results as dictionary