title: How to bucket a time stamp in 5 minute intervals in python
body: <p>I am using python to increment a counter in 5 minute intervals in redis and speed of the execution code is rather important.  I will have a sorted set that will look like this:</p>
  
  <pre><code>1:30 incr 1:35 incr ...
  </code></pre>
  
  <p>where the incr is the hit count between that 5 minute interval.</p>
  
  <p>Lets say I am at 1:32 pm and I want to place all of the hits between 1:30 and 1:35 in that bucket.  </p>
  
  <p>Naively I can just loop through a list and check if minute between 30 and 35 and place in the 1:30 bucket.  Is there a more pythonic method to do this?</p>