def __build_index(self, until=None, flush=False, verbose=False):
assert(self._indexed_file_handle is not None)<EOL>if flush:<EOL><INDENT>self._index = {}<EOL><DEDENT>file_loc = self._indexed_file_handle.tell()<EOL>if verbose:<EOL><INDENT>self._indexed_file_handle.seek(<NUM_LIT:0>, <NUM_LIT:2>)  <EOL>total = self._indexed_file_handle.tell() - file_loc<EOL>self._indexed_file_handle.seek(file_loc)  <EOL>pind = ProgressIndicator(totalToDo=total,<EOL>messagePrefix="<STR_LIT>",<EOL>messageSuffix="<STR_LIT>")<EOL><DEDENT>for item in self.record_iterator(self._indexed_file_handle):<EOL><INDENT>hash_val = self.record_hash_function(item)<EOL>self._index[hash_val] = file_loc<EOL>file_loc = self._indexed_file_handle.tell()<EOL>if until is not None and hash_val == until:<EOL><INDENT>break<EOL><DEDENT>if verbose:<EOL><INDENT>pind.done = file_loc<EOL>pind.showProgress()<EOL><DEDENT><DEDENT>
build/expand the index for this file.

:param until: expand the index until the record with this hash has been
              incorporated and then stop. If None, go until the iterator
              is exhausted. Note that if this hash is already in the index,
              no new items will be
:param flush: if True, anything already in the index is discarded.