This will require a recursive checker, mainly to solve the problem descibed by Target. And since I seem to be the only person writing recursive checkers....
I can write this for you, but I have two other projects on at the moment. I hope to get to this in a week or so. Will get back to you.
Tom