invest-applet: Do not use deprecated Python 2 syntax

This syntax is not supported in Python 3, so we need to remove it
before porting.

- Use print() function.
- Use 'except ... as ...' syntax.
- Use 'foo in dict' syntax.
- Use absolute imports.
- Use new syntax for octal numbers.

This commit is based on running 'futurize -1' command.