def METHOD_NAME(self, lang, text, purpose):
    """returns a langset xml Element setup with given parameters"""
    langset = etree.Element(self.languageNode)
    setXMLlang(langset, lang)
    seg = etree.SubElement(langset, self.textNode)
    # implied by the standard:
    # setXMLspace(seg, "preserve")
    try:
        seg.text = text
    except ValueError:
        # Prevents "All strings must be XML compatible" when string contains a control characters
        seg.text = valid_chars_only(text)
    return langset