def METHOD_NAME(self, last=True):
    """Remove and return (key, value) item pair.
    Pairs are returned in LIFO order if last is True or FIFO order if
    False.
    """
    index = -1 if last else 0
    num = self._nums.iloc[index]
    key = self._nums[num]
    value = self.pop(key)
    return key, value