def _insert(self, dom_group, idx=None, prepend=False, name=None):
        if idx and idx < 0:
            idx = 0
        if prepend:
            idx = 0
        else:
            idx = idx if idx is not None else len(self.childs)
        if dom_group is not None:
            if not isinstance(dom_group, Iterable) or isinstance(
                dom_group, (DOMElement, str)
            ):
                dom_group = [dom_group]
            for i_group, elem in enumerate(dom_group):
                if elem is not None:
                    self.childs.insert(idx + i_group, elem)
                    if issubclass(elem.__class__, DOMElement):
                        elem.parent = self
                    if name:
                        setattr(self, name, elem)