#NEWLINE# def isplit( pred , seq ) : #NEWLINE# #INDENT# pred = make_pred ( pred ) #NEWLINE# ( yes , no ) = ( deque ( ) , deque ( ) ) #NEWLINE# splitter = ( ( yes . append ( item ) if pred ( item ) else no . append ( item ) ) for item in seq ) #NEWLINE# def _isplit( q ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# while q : #NEWLINE# #INDENT# ( yield q . popleft ( ) ) #NEWLINE# #UNINDENT# next ( splitter ) #NEWLINE# #UNINDENT# #UNINDENT# return ( _isplit ( yes ) , _isplit ( no ) )