'prune out entries with lowest weight.'

def _prunelowestweight(self):

    numentries = len(self._dict)
    if (numentries >= self.maxentries):
        items = [(entry.weight, key) for (key, entry) in self._dict.items()]
        items.sort()
        index = (numentries - self.prunenum)
        if (index > 0):
            for (weight, key) in items[:index]:
                self.delentry(key, raising=False)
