title: Splitting a date range into equal subranges with remaining time allocated to the last
body: <p>Is there a more elegant/pythonic way to do what the title says and this function does?</p>
  
  <pre><code>def split_datetime_range(start, end, split):
      """Splits a range of dates into a list of equal ranges
      with remaining time allocated to the last of the series.
      This function doesn't overlap dates, so seconds are lost
      inbetween each range
  
      Parameters:
        start - The start of the range
        end - The end of the range
        split - How many ranges to produce
  
      Returns:
        A list of tuples, each tuple is its own range
      """
      total_seconds = int((end - start).total_seconds())
      delta = total_seconds / split
      starts = [start + timedelta(seconds=delta * i) for i in range(split)]
      ends = [s + timedelta(seconds=delta - 1) for s in starts]
      ends[len(ends) - 1] = end
      return zip(starts, ends)
  </code></pre>
  
  <p>edit -</p>
  
  <p>one constraint is it has to be in 'seconds' resolution and not 'microseconds' resolution. The idea is to generate a list of date ranges to supply to a web service that accepts dates in iso8601 with seconds resolution</p>