def contains_partial(haystack, needle):
if not isinstance(haystack, Element):<EOL><INDENT>haystack = parse_html(haystack)<EOL><DEDENT>if not isinstance(needle, Element):<EOL><INDENT>needle = parse_html(needle)<EOL><DEDENT>if (<EOL>needle.name == haystack.name and<EOL>set(needle.attributes).issubset(haystack.attributes)<EOL>):<EOL><INDENT>return True<EOL><DEDENT>return any(<EOL>contains_partial(child, needle) for child in haystack.children<EOL>if isinstance(child, Element)<EOL>)<EOL>
Search for a html element with at least the corresponding elements
    (other elements may be present in the matched element from the haystack)