def prune(self,func):
        count = 0
        cur = self.first
        while cur and func(cur.me[1]):
            count = count + 1
            cur2 = cur.next
            if cur2 is not None:
                cur2.prev = None
            del self.d[cur.me[0]]
            cur = cur2
        self.first = cur
        if cur is None or cur.next is None:
            self.last = cur
        return count
prune from left until func(self[x]) returns false
dataset/ETHPy150Open bonsaiviking/NfSpy/nfspy/lrucache.py/LRU.prune