def find_txt(xml_tree, path, default="<STR_LIT>"):
value = "<STR_LIT>"<EOL>try:<EOL><INDENT>xpath_applied = xml_tree.xpath(path)  <EOL>if len(xpath_applied) and xpath_applied[<NUM_LIT:0>] is not None:<EOL><INDENT>xpath_result = xpath_applied[<NUM_LIT:0>]<EOL>if isinstance(xpath_result, type(xml_tree)):<EOL><INDENT>value = xpath_result.text.strip()<EOL><DEDENT>else:<EOL><INDENT>value = xpath_result<EOL><DEDENT><DEDENT><DEDENT>except Exception:  <EOL><INDENT>value = default<EOL><DEDENT>return py23_compat.text_type(value)<EOL>
Extracts the text value from an XML tree, using XPath.
In case of error, will return a default value.

:param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>.
:param path:     XPath to be applied, in order to extract the desired data.
:param default:  Value to be returned in case of error.
:return: a str value.