def fetch(self, tagname, restraints={}):
    e = self.dom.getElementsByTagName(tagname)
    matches = []
    for node in e:
        match = 1
        for restraint in restraints:
            f = self.first(restraint, node)
            if (not f):
                match = 0
                break
            text = restraints[restraint]
            if (not f.contents[0].startswith(text)):
                match = 0
                break
        if match:
            tag = Tag(node)
            matches.append(tag)
    return matches
def fetch(self, tagname, restraints={}):
    e = self.dom.getElementsByTagName(tagname)
    matches = []
    for node in e:
        match = 1
        for restraint in restraints:
            f = self.first(restraint, node)
            if (not f):
                match = 0
                break
            text = restraints[restraint]
            if (not f.contents[0].startswith(text)):
                match = 0
                break
        if match:
            tag = Tag(node)
            matches.append(tag)
    return matches