I have fixed an error in this script.
It still contained a reference to the
RUP SOA plug-in, on which the original script was based.
There are still probably some minor
errors (I've worked through most of this, but piece-wise rather than systematically).
If you find additional errors, please
feel free to post a better version.