Added support for both Python 2 and Python 3