It shouldn't be hard, since what it basically does is create a mask (plus that you'd have to hunt down the other functions that it uses from the script and the required variables). I don't particularly remember why, but when I was writing a function of my own it didn't work as I expected it to have, so I ended up doing a crappy one for my own need. I wish I could remember a bit more about it now...
Code:
FUNCTION Starmask(clip input, bool anime, clip nullclp, float thstar, int lumathres)
...
maskstar = ConditionalFilter(maskstarvalidate, nullclp.mt_binarize(upper=false), maskstar.mt_inflate().mt_inflate, "AverageLuma()", "<", string(thStar),false)