<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _isolate_text_node(self, element):
 """ Isolate text nodes of element nodes. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """


        if (
            (element.has_children_elements())
            and (self._is_valid_element(element))
        ):
            if self._is_valid_element(element):
                child_nodes = element.get_children()
                for child_node in child_nodes:
                    if isinstance(child_node, HTMLDOMTextNode):
                        span = self.html_parser.create_element('span')
                        span.set_attribute(
                            AccessibleCSSImplementation.DATA_ISOLATOR_ELEMENT,
                            'true'
                        )
                        span.append_text(child_node.get_text_content())

                        child_node.replace_node(span)
            children = element.get_children_elements()
            for child in children:
                self._isolate_text_node(child)