#NEWLINE# def __getitem__( self , index ) : #NEWLINE# #INDENT# 'Get the value at a character position.\n\n        :Parameters:\n            `index` : int\n                Index of character.  Must be within range and non-negative.\n\n        :rtype: object\n        ' #NEWLINE# i = 0 #NEWLINE# for run in self . runs : #NEWLINE# #INDENT# if ( i <= index < ( i + run . count ) ) : #NEWLINE# #INDENT# return run . value #NEWLINE# #UNINDENT# i += run . count #NEWLINE# #UNINDENT# if ( index == i ) : #NEWLINE# #INDENT# return self . runs [ ( - 1 ) ] . value #NEWLINE# #UNINDENT# assert False , 'Index not in range'