code: def create_index(self):
          
          self.reset()
          counter = 0
          pre_time = time.time()
          while True:
              if counter % 1000 == 0:
                  cur_time = time.time()
                  print('time:', cur_time - pre_time, ' count:', counter)
              pos = self.tell()
              cont = self.read()
              if cont is None:
                  break
              key = self.key_type(counter)
              self.fidx.write('%s\t%d\n'%(str(key), pos))
              counter = counter + 1
docs: Creates the index file from open record file