#NEWLINE# def _format_list( item , identifier , stream ) : #NEWLINE# #INDENT# if ( not item ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if any ( ( isinstance ( el , dict ) for el in item ) ) : #NEWLINE# #INDENT# all_keys = _all_scalar_keys ( item ) #NEWLINE# for element in item : #NEWLINE# #INDENT# _format_text ( element , stream = stream , identifier = identifier , scalar_keys = all_keys ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if any ( ( isinstance ( el , list ) for el in item ) ) : #NEWLINE# #INDENT# ( scalar_elements , non_scalars ) = _partition_list ( identifier ) #NEWLINE# if scalar_elements : #NEWLINE# #INDENT# _format_scalar_list ( scalar_elements , identifier , stream ) #NEWLINE# #UNINDENT# for non_scalar in non_scalars : #NEWLINE# #INDENT# _format_text ( non_scalar , stream = stream , identifier = identifier ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# _format_scalar_list ( item , identifier , stream )