def getNodeByName(node, name):
    """
    Get the first child node matching a given local name
    """

    if node is None:
        raise Exception(
            "Cannot search for a child '%s' in a None object" % (name,)
        )
    if not name:
        raise Exception("Unspecified name to find node for.")
    try:
        childNode = node.xpath("*[local-name() = '%s']" % name)[0]
    except IndexError:
        return None
    return childNode