Whew. Take a look here if you want some complicated stuff. This is a guide written for complete idiots ("The Complete Idiot's Guide to Writing Shell Extensions") and I'm on my third time through it. Apparently I'm not a complete idiot.
My mission, if I choose to accept it, is to do that, in Python. It should be possible, but I have a translation deadline, um, yesterday, and so I don't have much more time than to note that link, globber something to the effect that "I'm soooo confused", and move on.