Various improvement, based on language builtins and PEP8, fix unreachable code with contextlib.
move import
Merge pull request #38 from Stranger6667/master

Various improvements and fix unreachable code