<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _trim_tree(state):
 """Trim empty leaf nodes from the tree. - To simplify the tree conversion, empty nodes are added before it is known if they will contain items that connect back to the authenticated subject. If there are no connections, the nodes remain empty, which causes them to be removed here. - Removing a leaf node may cause the parent to become a new empty leaf node, so the function is repeated until there are no more empty leaf nodes. """

    for n in list(state.tree.leaf_node_gen):
        if n.type_str == TYPE_NODE_TAG:
            n.parent.child_list.remove(n)
            return _trim_tree(state)