Possibly buggy first solution for judge.py.

Code may not compile at this point, but has the right idea.