def pops(self, maxRemove=None):
        """pop maxRemove elements from PQ and return a list of results

        If maxRemove < 0, all but maxRemove elements.  If >= 0,
        remove at most maxRemove elements (max len, of course).
        If None, remove all elements.  The result list is "best" first."""
        if maxRemove is None:
            maxRemove = len(self)
        elif maxRemove < 0:
            maxRemove += len(self)
        elif maxRemove > len(self):
            maxRemove = len(self)
        result = [None] * maxRemove
        for i in range(maxRemove):
            result[i] = self.pop()
        return result
pop maxRemove elements from PQ and return a list of results

        If maxRemove < 0, all but maxRemove elements.  If >= 0,
        remove at most maxRemove elements (max len, of course).
        If None, remove all elements.  The result list is "best" first.
recipes/Python/81693_Heapbased_priority_queue/recipe-81693.py