more py to js transformation in Treegenerator