sdb module: add backward-compatible support for Python 3.3+

test_db.py doesn't work for currently code already, and I fear it would be a big job to fix it...

All integration tests passed.