title: Get a structure of HTML code
body: <p>I'm using BeautifulSoup4 and I'm curious whether is there a function which returns a structure (ordered tags) of the HTML code. </p>
  
  <p>Here is an example:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;Simple example&lt;/h1&gt;
  &lt;p&gt;This is a simple example of html page&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>print <em>page.structure()</em>:</p>
  
  <pre><code>&gt;&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;&lt;/h1&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I tried to find a solution but no success.</p>
  
  <p>Thanks</p>