output = dict.fromkeys(days, 0)
while start <= end:
    day = days[start.weekday()]
if start.hour in data[day]:
    output[day] += 1
start = start + timedelta(minutes=60)
return output
data = {'Mon': [9, 23], 'Thu': [12, 13, 14], 'Tue': [11, 12, 14], 'Wed': [
    11, 12, 13, 14], 'Fri': [13], 'Sat': [], 'Sun': []}
start = datetime(2015, 7, 22, 17, 58, 54, 746784)
end = datetime(2015, 8, 30, 10, 22, 36, 363912)
print(solve(start, end, data))
Counting day-of-week-hour pairs between two dates