#NEWLINE# def questions_in_hierarchy( questions ) : #NEWLINE# #INDENT# result = [ ] #NEWLINE# question_lists_by_group = { #NEWLINE# #INDENT# None : result , #NEWLINE# #UNINDENT# } #NEWLINE# for question in questions : #NEWLINE# #INDENT# question_lists_by_group [ question . group ] . append ( question ) #NEWLINE# if ( ( question . type in ( 'Group' , 'Repeat' , 'FieldList' ) ) and ( question . value not in question_lists_by_group ) ) : #NEWLINE# #INDENT# question_lists_by_group [ question . value ] = result . children #NEWLINE# #UNINDENT# #UNINDENT# return question_lists_by_group [ None ]