Make changes to support python2.7.

Yes, this can not used on python3 now.
But, you can change back, just less  than 10 lines.

Signed-off-by: apporc <appleorchard2000@gmail.com>