#NEWLINE# def find_bookmark( self , bookmark , give_range = False ) : #NEWLINE# #INDENT# 'Determine an appropriate seek position near bookmark.' #NEWLINE# pos = 0 #NEWLINE# for chunk in self . chunks : #NEWLINE# #INDENT# if ( chunk . bookmark and ( chunk . bookmark < bookmark ) ) : #NEWLINE# #INDENT# pos = chunk . pos #NEWLINE# #UNINDENT# #UNINDENT# if give_range : #NEWLINE# #INDENT# ret_next = 0 #NEWLINE# for chunk in self . chunks : #NEWLINE# #INDENT# if ( ret_next == 1 ) : #NEWLINE# #INDENT# assert ( chunk . pos > pos ) #NEWLINE# return ( pos , chunk . pos ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( chunk . bookmark and ( chunk . bookmark > bookmark ) ) : #NEWLINE# #INDENT# ret_next = 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( pos , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return pos