title: Compare times with python
body: <p>I have data in a file with dates marked, for example, '2015.05.05-11:46', and want to read these lines and then see if they fulfill certain conditions. For example, as input to the function, I may have </p>
  
  <pre><code>get_times('hour', -3.0, -1.2)
  </code></pre>
  
  <p>which has function defintion:</p>
  
  <pre><code>get_times(unit, start_time, end_time):
  </code></pre>
  
  <p>which means I want to return all strings that are from -3.0 hours in the past to -1.2 hours in the past. I can get the current time with <code>now = datetime.datetime.now()</code>. Assuming I read in <code>time1 = '2015.05.05-11:46'</code>, how do I compare that to <code>now</code> and find out if it is within <code>start_time</code> and <code>end_time</code> <code>unit</code>s from now?</p>