def getLastChild(element, index, name=None):
    if element.nodeType != element.ELEMENT_NODE:
        raise SyntaxError("Wrong node type in getLastChild()")

    child = element.childNodes.item(index)
    if child == None:
        raise SyntaxError("Missing child: '%s'" % name)
    if child != element.lastChild:
        raise SyntaxError("Too many elements under: '%s'" % element.tagName)
    checkName(child, name)
    return child

#Regular expressions for syntax-checking attribute and element content
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/tlslite/utils/xmltools.py/getLastChild/original