#NEWLINE# def flatten( l ) : #NEWLINE# #INDENT# result = [ ] #NEWLINE# for i in l : #NEWLINE# #INDENT# if ( hasattr ( i , '__iter__' ) and ( not isinstance ( i , basestring ) ) ) : #NEWLINE# #INDENT# result . extend ( flatten ( i ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result . append ( i ) #NEWLINE# #UNINDENT# #UNINDENT# return result