python 3 support

Added support for Python 3. Tested with Python 3.4.