lib/tdb: convert print func to be py2/py3 compatible