Python3 Compatibility, Remove Empty Trailing Spaces

- Python3 Compatibility.
- Remove Empty Trailing Spaces.
- Logic is not touched.
- Add Encoding declaration.

 :octocat: