def _lineage(block):
 parent = block.get_parent()
 while parent:
  (yield parent)
  parent = parent.get_parent()

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