Python 2/3 Support

Added some logic for Python 3 support that maintains Python 2 support