def tags_with_text(xml, tags=None):
    """Return a list of tags that contain text retrieved recursively from an
    XML tree."""
    if tags is None:
        tags = []
    for element in xml:
        if element.text is not None:
            tags.append(element)
        elif len(element) > 0:  # pylint: disable=len-as-condition
            tags_with_text(element, tags)
        else:
            message = 'Unknown XML structure: {}'.format(element)
            raise ValueError(message)
    return tags
Return a list of tags that contain text retrieved recursively from an
    XML tree.