<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_list_heading(self):
 """ Generate the list of heading links of page. """


        local = self.parser.find('body').first_result()
        id_container_heading_before = (
            AccessibleNavigationImplementation.ID_CONTAINER_HEADING_BEFORE
        )
        id_container_heading_after = (
            AccessibleNavigationImplementation.ID_CONTAINER_HEADING_AFTER
        )
        if local is not None:
            container_before = self.parser.find(
                '#'
                + id_container_heading_before
            ).first_result()
            if (container_before is None) and (self.elements_heading_before):
                container_before = self.parser.create_element('div')
                container_before.set_attribute(
                    'id',
                    id_container_heading_before
                )

                text_container_before = self.parser.create_element('span')
                text_container_before.set_attribute(
                    'class',
                    AccessibleNavigationImplementation.CLASS_TEXT_HEADING
                )
                text_container_before.append_text(self.elements_heading_before)

                container_before.append_element(text_container_before)
                local.prepend_element(container_before)
            if container_before is not None:
                self.list_heading_before = self.parser.find(
                    container_before
                ).find_children('ol').first_result()
                if self.list_heading_before is None:
                    self.list_heading_before = self.parser.create_element('ol')
                    container_before.append_element(self.list_heading_before)

            container_after = self.parser.find(
                '#'
                + id_container_heading_after
            ).first_result()
            if (container_after is None) and (self.elements_heading_after):
                container_after = self.parser.create_element('div')
                container_after.set_attribute('id', id_container_heading_after)

                text_container_after = self.parser.create_element('span')
                text_container_after.set_attribute(
                    'class',
                    AccessibleNavigationImplementation.CLASS_TEXT_HEADING
                )
                text_container_after.append_text(self.elements_heading_after)

                container_after.append_element(text_container_after)
                local.append_element(container_after)
            if container_after is not None:
                self.list_heading_after = self.parser.find(
                    container_after
                ).find_children('ol').first_result()
                if self.list_heading_after is None:
                    self.list_heading_after = self.parser.create_element('ol')
                    container_after.append_element(self.list_heading_after)
        self.list_heading_added = True