Refactor to support Python 2.6.x

Change-Id: Ib938f72c53afe3103acc9016b9325c7312dbf5d7
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>