'Querying' a data structure in Python based on a datetime
<p>I need a data structure which can handle the following:</p>

<pre><code>date_from (datetime)
date_to (datetime)
value (float)
</code></pre>

<p>...and I need to be able to 'query' this data structure based on a datetime (e.g. in pseudocode: <code>SELECT * FROM data_structure WHERE a_datetime &gt;= date_from AND a_datetime &lt;= date_to;</code>).</p>

<p>If there isn't a result from this 'query', I would need to be able to insert a new value into the data structure.</p>

<p>What's the best way of doing this? (I'm a bit stuck at the moment)</p>
