It would nice if this could be run as a cmdline, or even better make it a separate python lib w/ cmdline support.