def find_root(resource):
 for location in lineage(resource):
  if (location.__parent__ is None):
   resource = location
   break
 return resource

def find_root ( resource ) : for location in lineage ( resource ) : if ( location . __parent__ is None ) : resource = location break return resource
find the top level namespace .