#NEWLINE# @ classmethod #NEWLINE# def tree_to_dict( cls , tree ) : #NEWLINE# #INDENT# '\n        Given an OptionTree, convert it into the equivalent dictionary format.\n        ' #NEWLINE# specs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for k in tree . keys ( ) : #NEWLINE# #INDENT# spec_key = '.' . join ( k ) #NEWLINE# specs [ spec_key ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for grp in tree [ k ] . groups : #NEWLINE# #INDENT# kwargs = tree [ k ] . groups [ grp ] . kwargs #NEWLINE# if kwargs : #NEWLINE# #INDENT# specs [ spec_key ] [ k ] = kwargs #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return specs