def _single_element(node, name):
    """If node contains one or more children with nodename "name", return the
    first one. If not, return None"""
    elems = node.getElementsByTagName(name)
    if elems: return elems[0]
    else: return None