Any chance you'd mind sharing that script? Sounds awesome.
Edit: Patched it up, it's at https://github.com/SethCurry/sdcli Feel free to make suggestions, open PRs or issues, whatever you'd like. I'll do some more clean up and commenting, I hadn't expected anyone to have much interest in using it but I don't mind maintaining it if it will get used.