#NEWLINE# def izip_longest( * args , **kwds ) : #NEWLINE# #INDENT# fillvalue = kwds . get ( 'fillvalue' ) #NEWLINE# def sentinel( counter = ( [ fillvalue ] * ( len ( args ) - 1 ) ) . pop ) : #NEWLINE# #INDENT# ( yield counter ( ) ) #NEWLINE# #UNINDENT# fillers = itertools . repeat ( fillvalue ) #NEWLINE# iters = [ itertools . chain ( it , sentinel ( ) , fillers ) for it in args ] #NEWLINE# try : #NEWLINE# #INDENT# for tup in itertools . izip ( * iters ) : #NEWLINE# #INDENT# ( yield tup ) #NEWLINE# #UNINDENT# #UNINDENT# except IndexError : #NEWLINE# #INDENT# pass