Explicitly use Python 3 shebang.
gitignore Vim swap files.
Use "is" instead of "==" when comparing with None.

Suggestion from PEP8.
Add main and error function, and use consistent string formatting.

I think this makes it a bit nicer if we ever decide to split stuff into
other functions/modules/etc.
Rework in pull request #1.
Merge pull request #2 from tom5760/small-fixes

Small fixes