'Destructively rips this element out of the tree.'

def extract(self):

    if self.parent:
        try:
            self.parent.contents.remove(self)
        except ValueError:
            pass
    lastChild = self._lastRecursiveChild()
    nextElement = lastChild.next
    if self.previous:
        self.previous.next = nextElement
    if nextElement:
        nextElement.previous = self.previous
    self.previous = None
    lastChild.next = None
    self.parent = None
    if self.previousSibling:
        self.previousSibling.nextSibling = self.nextSibling
    if self.nextSibling:
        self.nextSibling.previousSibling = self.previousSibling
    self.previousSibling = self.nextSibling = None
    return self
