With Tabs Python3 to Python2 + Flask fix

I've created the same pull request but now without the spaces modifications. All my changes are now in a separate commit, so it is easier to see what i did. 

1. First commit: Merged python3 branch to master.
2. Second commit: `2aac990` Added `compat.py` to support python3 and python2 from one source. (Maintaining one branch is less error-prone.)
3. Third commit: `4955268` Added the actual `Flask environment` fix.

Know it should be easier for you to see what i did :)