def rename(self, old_dn, new_dn):
        """Rename node.

        old_dn --- old distinguished name of node.
        new_dn --- new distinguished name of node.
        """
        if old_dn not in self.dn_set:
            raise ValueError("A record with dn=%s don't exists!" % new_dn)
        if new_dn in self.dn_set:
            raise ValueError("A record with dn=%s already exists!" % new_dn)
        self.remove(old_dn)
        self.add(new_dn)
Rename node.

        old_dn --- old distinguished name of node.
        new_dn --- new distinguished name of node.
        
recipes/Python/576966_DnTree/recipe-576966.py