More work on Python 3 compatibility.