def reverse_children(in_tree):
    return in_tree[0:1] + in_tree[1:][::-1]
lift_and_reverse = compose(reverse_children, lift_middle_child)
print(lift_and_reverse(('A', ('B',), ('C',), ('D',))))
библиотека для преобразования дерева узлов