add python3 support

- fix imports
- fix unicode literals
- update cmp to key  in `sorted` statement
- update func_code usage
- remove unused imports, optimize imports
- fix some spaces
make code more pep8, use one type of quotes
fix string format syntax
Fix tests for python 3
Updated README
Updated travis ci config for python 3