Wrap all scripts in functions

This is best practise in python scripts in order no to clutter the global
namespace.
12 jobs for python_bestpractise in 13 minutes and 50 seconds (queued for 1 second)