def date_range(data):
    """Returns the minimum activity start time and the maximum activity end time
    from the active entities response. These dates are modified in the following
    way. The hours (and minutes and so on) are removed from the start and end
    times and a *day* is added to the end time. These are the dates that should
    be used in the subsequent analytics request.
    """
    start = min([parse(d['activity_start_time']) for d in data])
    end = max([parse(d['activity_end_time']) for d in data])
    start = remove_hours(start)
    end = remove_hours(end) + timedelta(days=1)
    return start, end
Returns the minimum activity start time and the maximum activity end time
    from the active entities response. These dates are modified in the following
    way. The hours (and minutes and so on) are removed from the start and end
    times and a *day* is added to the end time. These are the dates that should
    be used in the subsequent analytics request.