human
Write me a the Python program you requested given the following:
Complete the below
def log_query(func):

    ''''A decorator for pseudo-logging search queries. Used in the ``SearchBackend``
    to wrap the ``search`` method.'
    '''
assistant
#Here is the Python program you requested.
    def wrapper(obj, query_string, *args, **kwargs):
        start = time()
        try:
            return func(obj, query_string, *args, **kwargs)
        finally:
            stop = time()
            if settings.DEBUG:
                from haystack import connections
                connections[obj.connection_alias].queries.append({u'query_string': query_string, u'additional_args': args, u'additional_kwargs': kwargs, u'time': (u'%.3f' % (stop - start)), u'start': start, u'stop': stop})
    return wrapper