def METHOD_NAME(self, parent, elements, level=0, count_check=False):
    nelements = len(elements)
    redo = False
    #print(elements[0])
    try:
        #if len(elements):
            #assert len(elements[0]) == 3, 'len=%s elements[0]=%s\nelements=\n%s\n' % (
                #len(elements[0]), elements[0], elements)
        for element in elements:
            #if isinstance(element, str):
                #print('elements = %r' % str(elements))
            #print('element = %r' % str(element))
            if not len(element) == 3:
                print('element = %r' % str(element))
            try:
                text, i, children = element
            except ValueError:
                #  [
                #     ('Point Data', None, [
                #         ('NodeID', 0, []),
                #         ('Displacement T_XYZ_subcase=1', 1, []),
                #         ('Displacement R_XYZ_subcase=1', 2, []),
                #     ])
                #  ]
                #
                # should be:
                #   ('Point Data', None, [
                #       ('NodeID', 0, []),
                #       ('Displacement T_XYZ_subcase=1', 1, []),
                #       ('Displacement R_XYZ_subcase=1', 2, []),
                #   ])
                print('failed element = ', element)
                raise
            nchildren = len(children)
            #print('text=%r' % text)
            item = QtGui.QStandardItem(text)
            parent.appendRow(item)
            # TODO: count_check and ???
            if nelements == 1 and nchildren == 0 and level == 0:
                #self.result_data_window.setEnabled(False)
                item.setEnabled(False)
                #print(dir(self.treeView))
                #self.treeView.setCurrentItem(self, 0)
                #item.mousePressEvent(None)
                redo = True
            #else:
                #pass
                #print('item=%s count_check=%s nelements=%s nchildren=%s' % (
                    #text, count_check, nelements, nchildren))
            if children:
                assert isinstance(children, list), children
                self.METHOD_NAME(item, children, level + 1, count_check=count_check)
                #print('*children = %s' % children)
        is_single = redo
        return is_single
    except ValueError:
        print()
        print(f'elements = {elements}')
        print(f'element = {element}')
        print(f'len(element) = {len(element)}')
        print(f'len(elements)={len(elements)}')
        for elem in elements:
            print('  e = %s' % str(elem))
        raise
    #if redo:
    #    data = [
    #        ('A', []),
    #        ('B', []),
    #    ]
    #    self.update_data(data)