def _lineage(block):
    """
    Return an iterator over all ancestors of the given block.
    """
    parent = block.get_parent()
    while parent:
        yield parent
        parent = parent.get_parent()
