def collect_indexing_data(entries, text_record_lengths):
 data = []
 entries = sorted(entries, key=attrgetter(u'start'))
 record_start = 0
 for rec_length in text_record_lengths:
  next_record_start = (record_start + rec_length)
  local_entries = []
  for entry in entries:
   if (entry.start >= next_record_start):
    break
   if ((entry.start + entry.length) <= record_start):
    continue
   local_entries.append(fill_entry(entry, (entry.start - record_start), rec_length))
  strands = separate_strands(local_entries)
  data.append(strands)
  record_start += rec_length
 return data

def collect_indexing_data ( entries , text_record_lengths ) : data = [ ] entries = sorted ( entries , key = attrgetter ( u'start' ) ) record_start = 0 for rec_length in text_record_lengths : next_record_start = ( record_start + rec_length ) local_entries = [ ] for entry in entries : if ( entry . start >= next_record_start ) : break if ( ( entry . start + entry . length ) <= record_start ) : continue local_entries . append ( fill_entry ( entry , ( entry . start - record_start ) , rec_length ) ) strands = separate_strands ( local_entries ) data . append ( strands ) record_start += rec_length return data
for every text record calculate which index entries start .