def text_with_children(node, debug=0):
    """
    DEPRECATED: return text content with children (#62), sub-elements (#66)

    Only used by deprecated template_to_dict_find(), and suffers from
    copypasta code smell.
    """

    # https://stackoverflow.com/questions/4624062/get-all-text-inside-a-tag-in-lxml

    if sys.version.startswith('3'):  # py3 needs encoding=str
        parts = ([node.text] +
                 list(chain(
                     *([tostring(c, with_tail=False, encoding=str),
                        c.tail] for c in node.getchildren())))
                 + [node.tail])
    else:
        parts = ([node.text] +
                 list(chain(
                     *([tostring(c, with_tail=False),
                        c.tail] for c in node.getchildren())))
                 + [node.tail])

    value = ''.join(filter(lambda x: x or isinstance(x, str), parts)).strip()

    if debug > 1:
        print("+ text_with_children:")
        print("  %s" % value)

    return value
DEPRECATED: return text content with children (#62), sub-elements (#66)

    Only used by deprecated template_to_dict_find(), and suffers from
    copypasta code smell.