Algorithm for parsing (poorly formatted) list of attributes
<p>I know I've seen a good algorithm for this, but having trouble finding it.</p>

<p>I've got a (poorly formatted) output from a tool (whose output style I cannot control) that I need to parse.</p>

<p>It looks something like this:</p>

<pre><code>NameOfItemA
attribute1 = values1
attribute2 = values2
...
attributen = valuesn
NameOfItemB
attribute1 = values1
attribute2 = values2
...
attributen = valuesn        
</code></pre>

<p>Where NameOfItemX and  attributeX is a clearly defined set of known names.  Need to turn it into reasonable objects:</p>

<pre><code>ObjectForA.attribute1 = values1
</code></pre>

<p>etc.</p>

<p>I know I've done this before, just cant remember how I did it.  It looked something like:</p>

<pre><code>for line in textinput:
    if line.find("NameOfItem"):
        ... parse until next one ...
</code></pre>

<p>Hopefully what I'm saying makes sense and someone can help</p>
