Making code compatible with 2.6.X Python