#NEWLINE# def get_item( self , i , d = None ) : #NEWLINE# #INDENT# result = [ ] #NEWLINE# if ( i < 0 ) : #NEWLINE# #INDENT# i += self . length #NEWLINE# #UNINDENT# if ( ( i < 0 ) or ( i >= self . length ) ) : #NEWLINE# #INDENT# raise IndexError ( ( 'Index %d out of bounds' % ( i , ) ) ) #NEWLINE# #UNINDENT# if ( len ( self . list_lengths ) == 1 ) : #NEWLINE# #INDENT# return self . list_lengths [ 0 ] [ 0 ] [ i ] #NEWLINE# #UNINDENT# for ( c , c_len ) in self . list_lengths : #NEWLINE# #INDENT# ( i , mod ) = divmod ( i , c_len ) #NEWLINE# if hasattr ( c , 'get_item' ) : #NEWLINE# #INDENT# result . append ( c . get_item ( mod , d ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result . append ( c [ mod ] ) #NEWLINE# #UNINDENT# #UNINDENT# return '' . join ( result )