@misc.disallow_when_frozen(FrozenNode)
    def disassociate(self):
        """Removes this node from its parent (if any).

        :returns: occurences of this node that were removed from its parent.
        """
        occurrences = 0
        if self.parent is not None:
            p = self.parent
            self.parent = None
            # Remove all instances of this node from its parent.
            while True:
                try:
                    p._children.remove(self)
                except __HOLE__:
                    break
                else:
                    occurrences += 1
        return occurrences
dataset/ETHPy150Open openstack/taskflow/taskflow/types/tree.py/Node.disassociate