@newrelic.agent.function_trace()
def get_content_sections(src=''):
 sections = []
 if src:
  attr = '[id]'
  selector = ((attr + ',').join(SECTION_TAGS) + attr)
  try:
   document = pq(src)
  except etree.ParserError:
   pass
  else:
   for element in document.find(selector):
    sections.append({'title': element.text, 'id': element.attrib.get('id')})
 return sections

@ newrelic . agent . function_trace ( ) def get_content_sections ( src = '' ) : sections = [ ] if src : attr = '[id]' selector = ( ( attr + ',' ) . join ( SECTION_TAGS ) + attr ) try : document = pq ( src ) except etree . ParserError : pass else : for element in document . find ( selector ) : sections . append ( { 'title' : element . text , 'id' : element . attrib . get ( 'id' ) } ) return sections
gets sections in a document .