def METHOD_NAME(self, container):
    initials = self.get_style('initials', container)
    def hande_level(index_entries, level=1):
        top_level = level == 1
        entries = sorted((name for name in index_entries if name),
                         key=lambda s: (s.lower(), s))
        last_section = None
        for entry in entries:
            first = entry[0]
            section = first.upper() if first.isalpha() else 'Symbols'
            term, subentries = index_entries[entry]
            if initials and top_level and section != last_section:
                yield IndexLabel(section)
                last_section = section
            target_ids = [target.get_id(document)
                          for term, target in subentries.get(None, ())]
            yield IndexEntry(term, level, target_ids)
            for paragraph in hande_level(subentries, level=level + 1):
                yield paragraph
    document = container.document
    index_entries = container.document.index_entries
    for paragraph in hande_level(index_entries):
        yield paragraph