python/samba: port changes to allow samba.tests.dsdb_lock to work with PY3/PY2