Reformat into a main routine
Introduce a class object to hold application level parameters
Add --new option and enable local operation

Specifying both dryrun and --new will make the script skip contacting
the remote twiki server, which can provide for faster testing.
Use string.Template instead of regex substitution
Add --dry-run command line option
Add --debug command line option