human
Complete the below
def do_split(split_point, log, before=True):

    ''''Split tree into a *before* and an *after* tree at ``split_point``.
    :param split_point: The Element at which to split
    :param before: If True tree is split before split_point, otherwise after split_point
    :return: before_tree, after_tree'
    '''
 Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    if before:
        split_point = adjust_split_point(split_point, log)
    tree = split_point.getroottree()
    path = tree.getpath(split_point)
    (tree, tree2) = (copy.deepcopy(tree), copy.deepcopy(tree))
    (root, root2) = (tree.getroot(), tree2.getroot())
    (body, body2) = map(get_body, (root, root2))
    split_point = root.xpath(path)[0]
    split_point2 = root2.xpath(path)[0]
    def nix_element(elem, top=True):
        parent = elem.getparent()
        if top:
            parent.remove(elem)
        else:
            index = parent.index(elem)
            parent[index:(index + 1)] = list(elem.iterchildren())
    hit_split_point = False
    keep_descendants = False
    split_point_descendants = frozenset(split_point.iterdescendants())
    for elem in tuple(body.iterdescendants()):
        if (elem is split_point):
            hit_split_point = True
            if before:
                nix_element(elem)
            else:
                keep_descendants = True
                elem.tail = u'\n'
            continue
        if hit_split_point:
            if keep_descendants:
                if (elem in split_point_descendants):
                    continue
                else:
                    keep_descendants = False
            nix_element(elem)
    ancestors = frozenset(XPath(u'ancestor::*')(split_point2))
    for elem in tuple(body2.iterdescendants()):
        if (elem is split_point2):
            if (not before):
                tail = elem.tail
                if (tail and (not tail.isspace())):
                    parent = elem.getparent()
                    idx = parent.index(elem)
                    if (idx == 0):
                        parent.text = ((parent.text or u'') + tail)
                    else:
                        sib = parent[(idx - 1)]
                        sib.tail = ((sib.tail or u'') + tail)
                nix_element(elem)
            break
        if (elem in ancestors):
            elem.text = u'\n'
        else:
            nix_element(elem, top=False)
...