A lot more work on dbn.py - not fully tested, but has useful functionality.
Cleaning