human
Complete the below
def dynamic_activity_data(request):

    ''''Large database acitivity widget helper.
    This method serves as a helper for the activity widget, it\'s used with for
    AJAX requests based on date ranges passed to it.'
    '''

Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    direction = request.GET.get(u'direction')
    range_end = request.GET.get(u'range_end')
    range_start = request.GET.get(u'range_start')
    days_total = DAYS_TOTAL
    if range_end:
        range_end = datetime.datetime.fromtimestamp(time.mktime(time.strptime(range_end, u'%Y-%m-%d')))
    if range_start:
        range_start = datetime.datetime.fromtimestamp(time.mktime(time.strptime(range_start, u'%Y-%m-%d')))
    if ((direction == u'next') and range_end):
        new_range_start = range_end
        new_range_end = (new_range_start + datetime.timedelta(days=days_total))
    elif ((direction == u'prev') and range_start):
        new_range_start = (range_start - datetime.timedelta(days=days_total))
        new_range_end = range_start
    elif ((direction == u'same') and range_start and range_end):
        new_range_start = range_start
        new_range_end = range_end
    else:
        new_range_end = (datetime.datetime.now() + datetime.timedelta(days=1))
        new_range_start = (new_range_end - datetime.timedelta(days=days_total))
    current_tz = timezone.get_current_timezone()
    new_range_start = timezone.make_aware(new_range_start, current_tz)
    new_range_end = timezone.make_aware(new_range_end, current_tz)
    response_data = {u'range_start': new_range_start.strftime(u'%Y-%m-%d'), u'range_end': new_range_end.strftime(u'%Y-%m-%d')}
    def large_stats_data(range_start, range_end):
        def get_objects(model_name, timestamp_field, date_field):
            u'Perform    timestamp    based    queries.\n\n                                                This    method    receives    a    dynamic    model    name    and    performs    a    filter\n                                                query.    Later    the    results    are    grouped    by    day    and    prepared    for    the\n                                                charting    library.\n                                                '
            args = (u'%s__range' % timestamp_field)
            q =...