'Delete unreachable and orphan blocks.'

def normalize(self):

    queue = set([self.entry_point])
    visited = set()
    while queue:
        root = queue.pop()
        visited.add(root)
        for child in root.children:
            if (child not in visited):
                queue.add(child)
    unreachable = (self.blocks - visited)
    for block in unreachable:
        block.detach()
    visited.remove(self.entry_point)
    for block in visited:
        if block.empty():
            for parent in block.parents:
                for child in block.children:
                    parent.add_child(child)
            block.detach()
            unreachable.add(block)
    self.blocks -= unreachable
