Make the code Python 2.4 compatible

Change-Id: Idad1f3b21a196cac5eac2f92d8d15efc4efbd0ce