def getFirstAncestorWithSectionHeader(entry):
 for a in domhelpers.getParents(entry)[1:]:
  headers = domhelpers.findNodesNamed(a, 'h2')
  if (len(headers) > 0):
   return headers
 return []

def getFirstAncestorWithSectionHeader ( entry ) : for a in domhelpers . getParents ( entry ) [ 1 : ] : headers = domhelpers . findNodesNamed ( a , 'h2' ) if ( len ( headers ) > 0 ) : return headers return [ ]
visit the ancestors of c{entry} until one with at least one c{h2} child node is found .