Make it compatible with Python 2.7 and 3 using module 'six'