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.
I wonder if in addition to this, the `decode_long` method should use `int` for Python 3 so that existing code which calls `decode_long` is easier to port over. Thoughts?