def first(self, tagname, root=None):
    found = None
    if (root == None):
        e = self.dom.getElementsByTagName(tagname)
        if (len(e) > 0):
            found = e[0]
    else:
        for node in root.childNodes:
            if (node.nodeName == tagname):
                found = node
                break
    if (not found):
        return None
    tag = Tag(found)
    return tag
def first(self, tagname, root=None):
    found = None
    if (root == None):
        e = self.dom.getElementsByTagName(tagname)
        if (len(e) > 0):
            found = e[0]
    else:
        for node in root.childNodes:
            if (node.nodeName == tagname):
                found = node
                break
    if (not found):
        return None
    tag = Tag(found)
    return tag