It's interesting but I don't know if I agree with the conclusion that writing this small function in C would make maintenance too hard. How often do you expect to have to change it?
Maintainance in this case involves the effort of deploying to servers, compiling it as necessary, and similar efforts. The deployment process is complex as is (internally, of course --- it's one script to run --- but that doesn't help if something obscure breaks). I suppose it would be possible to produce it as a python package and use those standard methods, but at that point it makes sense to open source and then it should be beefed up and so on and so forth.