Improved python3 compatibility and applied some flake8 fixes.
For python3 comptibility replaced:
- print by print function from future or by python logger to improve python3 compatibility,
To fix flake8 warnings, replaced
- membership test: not [val] in [dict] by [val] not in [dict],
- ==None by is None and !=None by not is None,
- removed trailing
;