python code generation now handles recursive structures