def remove(self, dn):
        """Remove node and its subtree.

        dn --- distinguished name of node.
        """

        if dn not in self.dn_set:
            raise ValueError('A record with dn=%s doesn\'t exists!' % dn)

        parent = self.get_parent_dn(dn)
        fake_parent = self.get_fake_parent_dn(dn)

        if parent != fake_parent:
            self.fake_parent[fake_parent].remove(dn)

        self.childs[parent].remove(dn)

        if dn in self.childs.keys():
            childs = tuple(self.childs[dn])
            for i in childs:
                self.remove(i)
            self.childs.pop(dn)

        self.parent.pop(dn)
        self.dn_set.remove(dn)
Remove node and its subtree.

        dn --- distinguished name of node.
        
recipes/Python/576966_DnTree/recipe-576966.py