Update visitor to be compatible with Python 3.