Updated to work with Python 3

unicode() function is deprecated in Python 3, so added a check for version of Python. If Python 3 is used then str() function will be called to convert the text instead of unicode(). Ran the tests and did some ad hoc parsing with both Python 2 and 3.