Compare two html text in python
<p>I have a requirement wherein I store html text as string in python and want to compare them. </p>

<pre><code>str1 = '&lt;br&gt; Example1'
str2 = '&lt;br/&gt;     Example1'
</code></pre>

<p>If I do a normal <code>str1 == str2</code>, it will be <code>False</code>. But in html they are equal. 
At the same time </p>

<pre><code>str1 = '&lt;br&gt; Example1'
str2 = '&lt;p&gt; Example1'
</code></pre>

<p>is not html equal. Same goes with <code>str2 = '&lt;b&gt; Example &lt;/b&gt;'</code> where <code>str1!=str2</code></p>

<p>Are there any way to do it in python. I know the test case has <code>self.assertInEmail</code> which does html comparison, but I dont want to use test functions in my production code.</p>