Fix Python 3 compatability issues.

Change-Id: Ib7501cf710340ec58d654f3496aa1c669c369eef