Scripting firmware upgrades

Has anyone had any luck using Perl, Python, etc. to script the upgrade of firmware for CM 32 hardware? If so, would you mind sharing the code?

Thanks,

Derk