'return a mapping of matchresults to their index among all
matches, sorted by the start position of the matchresult'

def _resultindex(self):

    d = {}
    i = 0
    for result in sorted(self.allmatches, key=(lambda mr: mr.start)):
        d[result] = i
        i += 1
    return d
