def remove(self, node):
        """Remove a node from the list."""
        if not isinstance(node, Node):
            raise TypeError('expecting Node instance')
        if node._list is None:
            return
        if node._list is not self:
            raise RuntimeError('node is not contained in list')
        if node._next is None:
            self._last = node._prev  # last node
        else:
            node._next._prev = node._prev
        if node._prev is None:
            self._first = node._next  # first node
        else:
            node._prev._next = node._next
        node._list = node._prev = node._next = None
        self._size -= 1
Remove a node from the list.