def _subdivide_interval_by_date(start, end):
 if (start.date() == end.date()):
  date_to_secs = {start.date(): _to_secs((end - start))}
 else:
  date_to_secs = {}
  date_to_secs[start.date()] = _to_secs(((datetime(start.year, start.month, start.day) + timedelta(days=1)) - start))
  date_to_secs[end.date()] = _to_secs((end - datetime(end.year, end.month, end.day)))
  cur_date = (start.date() + timedelta(days=1))
  while (cur_date < end.date()):
   date_to_secs[cur_date] = _to_secs(timedelta(days=1))
   cur_date += timedelta(days=1)
 date_to_secs = dict(((d, secs) for (d, secs) in date_to_secs.items() if secs))
 return date_to_secs

def _subdivide_interval_by_date ( start , end ) : if ( start . date ( ) == end . date ( ) ) : date_to_secs = { start . date ( ) : _to_secs ( ( end - start ) ) } else : date_to_secs = { } date_to_secs [ start . date ( ) ] = _to_secs ( ( ( datetime ( start . year , start . month , start . day ) + timedelta ( days = 1 ) ) - start ) ) date_to_secs [ end . date ( ) ] = _to_secs ( ( end - datetime ( end . year , end . month , end . day ) ) ) cur_date = ( start . date ( ) + timedelta ( days = 1 ) ) while ( cur_date < end . date ( ) ) : date_to_secs [ cur_date ] = _to_secs ( timedelta ( days = 1 ) ) cur_date += timedelta ( days = 1 ) date_to_secs = dict ( ( ( d , secs ) for ( d , secs ) in date_to_secs . items ( ) if secs ) ) return date_to_secs
convert a time interval to a map from :py:class:datetime .