def get(self, tag=None, **kwargs):
<EOL>if tag is None: tag = dom_tag<EOL>attrs = [(dom_tag.clean_attribute(attr), value)<EOL>for attr, value in kwargs.items()]<EOL>results = []<EOL>for child in self.children:<EOL><INDENT>if (isinstance(tag, basestring) and type(child).__name__ == tag) or(not isinstance(tag, basestring) and isinstance(child, tag)):<EOL><INDENT>if all(child.attributes.get(attribute) == value<EOL>for attribute, value in attrs):<EOL><INDENT>results.append(child)<EOL><DEDENT><DEDENT>if isinstance(child, dom_tag):<EOL><INDENT>results.extend(child.get(tag, **kwargs))<EOL><DEDENT><DEDENT>return results<EOL>
Recursively searches children for tags of a certain
type with matching attributes.