def insert_children(self, before, insert):
        """ Insert children into this object at the given location.

        The children will be automatically parented and inserted into
        the object's children. If any children are already children of
        this object, then they will be moved appropriately.

        Parameters
        ----------
        before : Object, int or None
            A child object or int to use as the marker for inserting
            the new children. The new children will be inserted before
            this marker. If the Object is None or not a child, or if
            the int is not a valid index, then the new children will be
            added to the end of the children.

        insert : iterable
            An iterable of Object children to insert into this object.

        Notes
        -----
        It is the responsibility of the caller to initialize and activate
        the object as needed, if it is reparented dynamically at runtime.

        """
        insert_list = list(insert)
        insert_set = set(insert_list)
        if self in insert_set:
            raise ValueError('cannot use `self` as Object child')
        if len(insert_list) != len(insert_set):
            raise ValueError('cannot insert duplicate children')
        if not all(isinstance(child, Object) for child in insert_list):
            raise TypeError('children must be an Object instances')

        if isinstance(before, int):
            try:
                before = self._children[before]
            except IndexError:
                before = None

        new = []
        added = False
        for child in self._children:
            if insert_set in child:
                insert_set.remove(child)
                continue
            if child is before:
                new.extend(insert_list)
                added = True
            new.append(child)
        if not added:
            new.extend(insert_list)

        for child in insert_list:
            old_parent = child._parent
            if old_parent is not self:
                child._parent = self
                child.parent_changed(old_parent, self)
                if old_parent is not None:
                    old_parent.child_removed(child)

        self._children = new
        child_added = self.child_added
        child_moved = self.child_moved
        for child in insert_list:
            if child in insert_set:
                child_added(child)
            else:
                child_moved(child)
dataset/ETHPy150Open nucleic/enaml/enaml/core/object.py/Object.insert_children/swapped operands of `in`