Interpreting python segment
<p>I'm new to python and came across this segment of code. Can someone help me with the syntax here? Maybe provide some comments on each line to how it's working? <code>xs</code> is a list that contains dates.</p>

<pre><code>    data = {}

    for title, d in tmpdata.items():

        data[title] = [x in d and d[x][statid] or 0 for x in xs]
        data[title][-1] = maxs[statid]
</code></pre>
