def remove(self, elem, count=1):
        rev = False
        if count:
            if count < 0:
                rev = True
                count = -count
                l = list(reversed(self))
            else:
                l = list(self)
            while count:
                try:
                    l.remove(elem)
                    count -= 1
                except ValueError:
                    break
        else:
            l = [v for v in self if v != elem]
        removed = len(l) - len(self)
        if removed:
            self.clear()
            self.extend(reversed(l) if rev else l)
        return removed
dataset/ETHPy150Open quantmind/pulsar/pulsar/utils/structures/misc.py/Deque.remove/swapped operands of `-`