'Detach block from parents and children.'

def detach(self):

    for child in self.children:
        child.parents.remove(self)
    for parent in self.parents:
        parent.children.remove(self)
    self.parents.clear()
    self.children.clear()
