Added visitor code

Python2 version, in principle the same as Python3 target, minus the types.

I took a look at the java test for the listeners, but I'm not sure how to approach this. It's not that I don't know  java, but I'm not sure what and how to test.