def find_resources(files, tagname, attrname, filter=None):
    class FindResources(HTMLParser.HTMLParser):
        # Nested parser class shares locals with enclosing function.
        def handle_startendtag(self, tag, attrs):
            self.handle_starttag(tag, attrs)
        def handle_starttag(self, tag, attrs):
            attrs = dict(attrs)
            if tag == tagname and (filter is None or filter(attrs)):
                # Accept only local URIs.
                uri = urlparse.urlparse(attrs[attrname])
                if uri[0] in ('','file') and not uri[1] and uri[2]:
                    result.append(uri[2])
    if isinstance(files, str):
        files = [files]
    result = []
    for filename in files:
        verbose('finding resources in: %s' % filename)
        if OPTIONS.dry_run:
            continue
        parser = FindResources()
        # HTMLParser has problems with non-ASCII strings.
        # See http://bugs.python.org/issue3932
        contents = read_file(filename)
        mo = re.search(r'\A<\?xml.* encoding="(.*?)"', contents)
        if mo:
            encoding = mo.group(1)
            parser.feed(contents.decode(encoding))
        else:
            parser.feed(contents)
        parser.close()
    result = list(set(result))   # Drop duplicate values.
    result.sort()
    return result

# NOT USED.
Extend an 'and_expr' by adding one more check.
dataset/ETHPy150Open FooBarWidget/mizuho/asciidoc/a2x.py/find_resources--crossover with--dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/openstack/common/policy.py/ParseState._extend_and_expr