Added support for Python 3 with the six module