def getNode(node, tagpath):
    """returns the *first* matching node for given tag path."""
    if tagpath == '':
        return node
    assert type(tagpath) == str
    tags = tagpath.split('/')
    assert len(tags) > 0
    for tag in tags:
        currentNode = None
        for child in node.tags():
            if child.name() == tag:
                currentNode = child
                break
        if not currentNode:
            return None
        else:
            node = currentNode
    return currentNode
