Make this work with Python 3, and do some minor cleanup

Works with Python 3.3.5 and 2.7.7 and the latest version of icalendar.
Why did you get rid of the `main` function and put all this code in the top level?