<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _visit(self, element, operation):
 """ Visit and execute a operation in element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param operation: The operation to be executed. :type operation: function """


        if self._is_valid_inherit_element(element):
            if element.has_children_elements():
                children = element.get_children_elements()
                for child in children:
                    self._visit(child, operation)
            elif self._is_valid_element(element):
                operation(element)