Changes to add Python 3 compatibility.