Numerous fixes

* fix typos with context
* fix comparison with None
* remove unused imports
* fix imports order (according to pep8)
* style fixes (according to pep8)
* another minor fixes