title: Rounding time in Python
body: <p>What would be an elegant, efficient and Pythonic way to perform a h/m/s rounding operation on time related types in Python with control over the rounding resolution?</p>
  
  <p>My guess is that it would require a time modulo operation. Illustrative examples:</p>
  
  <ul>
  <li>20:11:13 % (10 seconds) => (3 seconds)</li>
  <li>20:11:13 % (10 minutes) => (1 minutes and 13 seconds)</li>
  </ul>
  
  <p>Relevant time related types I can think of:</p>
  
  <ul>
  <li><code>datetime.datetime</code> \ <code>datetime.time</code></li>
  <li><code>struct_time</code></li>
  </ul>