'''python
if period_length == 'day':
    last_period = time - datetime.timedelta(days=1)
elif period_length == 'hour':
    last_period = time - datetime.timedelta(hours=1)

start = datetime.datetime(year=last_period.year,
                                      month=last_period.month,
                                      day=last_period.day,
                                      hour=last_period.hour)
end = datetime.datetime(year=time.year,
                                    month=time.month,
                                    day=time.day,
                                    hour=time.hour)
'''