def lineage(resource):
 while (resource is not None):
  (yield resource)
  try:
   resource = resource.__parent__
  except AttributeError:
   resource = None

def lineage ( resource ) : while ( resource is not None ) : ( yield resource ) try : resource = resource . __parent__ except AttributeError : resource = None
return a generator representing the :term:lineage of the :term:resource object implied by the resource argument .