Ported to Python.

Python is a depndency for SCons users, so this avoids an extra
dependency on Ruby.