Update for Python 3 syntax

Updates the file for Python 3, so it runs with Sublime Text 3.

Not sure whether there is a better way than explicitly converting all_before and all_after to lists ...!? But that works.
Merge pull request #6 from JohnArcher/master

Update to work with Python 3/Sublime Text 3.