'Remove sub elements that match the given name or XPath.
If the element is in a path, then any parent elements that become
empty after deleting the element may also be deleted if requested
by setting all=True.
:param name: The name or XPath expression for the element(s) to remove.
:param bool all: If True, remove all empty elements in the path to the
deleted element. Defaults to False.'

def _del_sub(self, name, all=False, lang=None):

    path = self._fix_ns(name, split=True)
    original_target = path[(-1)]
    default_lang = self.get_lang()
    if (not lang):
        lang = default_lang
    for (level, _) in enumerate(path):
        element_path = u'/'.join(path[:(len(path) - level)])
        parent_path = u'/'.join(path[:((len(path) - level) - 1)])
        elements = self.xml.findall(element_path)
        parent = self.xml.find(parent_path)
        if elements:
            if (parent is None):
                parent = self.xml
            for element in elements:
                if ((element.tag == original_target) or (not list(element))):
                    elem_lang = element.attrib.get((u'{%s}lang' % XML_NS), default_lang)
                    if ((lang == u'*') or (elem_lang == lang)):
                        parent.remove(element)
        if (not all):
            return
