'Move all of this tag\'s children into another tag.'

def reparentChildren(self, new_parent):

    element = self.element
    new_parent_element = new_parent.element
    final_next_element = element.next_sibling
    new_parents_last_descendant = new_parent_element._last_descendant(False, False)
    if (len(new_parent_element.contents) > 0):
        new_parents_last_child = new_parent_element.contents[(-1)]
        new_parents_last_descendant_next_element = new_parents_last_descendant.next_element
    else:
        new_parents_last_child = None
        new_parents_last_descendant_next_element = new_parent_element.next_element
    to_append = element.contents
    append_after = new_parent_element.contents
    if (len(to_append) > 0):
        first_child = to_append[0]
        if new_parents_last_descendant:
            first_child.previous_element = new_parents_last_descendant
        else:
            first_child.previous_element = new_parent_element
        first_child.previous_sibling = new_parents_last_child
        if new_parents_last_descendant:
            new_parents_last_descendant.next_element = first_child
        else:
            new_parent_element.next_element = first_child
        if new_parents_last_child:
            new_parents_last_child.next_sibling = first_child
        last_child = to_append[(-1)]
        last_child.next_element = new_parents_last_descendant_next_element
        if new_parents_last_descendant_next_element:
            new_parents_last_descendant_next_element.previous_element = last_child
        last_child.next_sibling = None
    for child in to_append:
        child.parent = new_parent_element
        new_parent_element.contents.append(child)
    element.contents = []
    element.next_element = final_next_element
