def add(self, score, filepath):
        """
        qu = _ScoreQueue(3)
        for i in [1,3,2,4,5,7,3, 8, 2, 2, 1]:
            print(qu.add(i*10, 'path'+str(i)), qu._queue)
        """
        i = len(self._queue)
        while i >= 1:
            sc, _ = self._queue[i - 1]
            if sc > score:
                break
            i -= 1
        self._queue = self._queue[:i] + [(score, filepath)] + self._queue[i:]
        if len(self._queue) > self.max_size:
            to_delete = self._queue[-1]
            del self._queue[-1]
            return to_delete

        qu = _ScoreQueue(3)
        for i in [1,3,2,4,5,7,3, 8, 2, 2, 1]:
            print(qu.add(i*10, 'path'+str(i)), qu._queue)
        
surreal/utils/checkpoint.py