human
What is a Python code to compute the ETag and last modified time for given the following:
Complete the below
def condition(etag_func=None, last_modified_func=None):

    ''''Decorator to support conditional retrieval (or change) for a view
    function.
    The parameters are callables to compute the ETag and last modified time for
    the requested resource, respectively. The callables are passed the same
    parameters as the view itself. The Etag function should return a string (or
    None if the resource doesn\'t exist), whilst the last_modified function
    should return a datetime object (or None if the resource doesn\'t exist).
    If both parameters are provided, all the preconditions must be met before
    the view is processed.
    This decorator will either pass control to the wrapped view function or
    return an HTTP 304 response (unmodified) or 412 response (preconditions
    failed), depending upon the request method.
    Any behavior marked as "undefined" in the HTTP spec (e.g. If-none-match
    plus If-modified-since headers) will result in the view function being
    called.'
    '''
assistant
#Here is Python code to compute the ETag and last modified time for
.
    def decorator(func):
        def inner(request, *args, **kwargs):
            if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE')
            if_none_match = request.META.get('HTTP_IF_NONE_MATCH')
            if_match = request.META.get('HTTP_IF_MATCH')
            if (if_none_match or if_match):
                try:
                    etags = parse_etags((if_none_match or if_match))
                except ValueError:
                    if_none_match = None
                    if_match = None
            if etag_func:
                res_etag = etag_func(request, *args, **kwargs)
            else:
                res_etag = None
            if last_modified_func:
                dt = last_modified_func(request, *args, **kwargs)
                if dt:
                    res_last_modified = (formatdate(timegm(dt.utctimetuple()))[:26] + 'GMT')
                else:
                    res_last_modified = None
            else:
                res_last_modified = None
            response = None
            if (not ((if_match and (if_modified_since or if_none_match)) or (if_match and if_none_match))):
                if ((if_none_match and ((res_etag in etags) or (('*' in etags) and res_etag))) and ((not if_modified_since) or (res_last_modified == if_modified_since))):
                    if (request.method in ('GET', 'HEAD')):
                        response = HttpResponseNotModified()
                    else:
                        response = HttpResponse(status=412)
                elif (if_match and (((not res_etag) and ('*' in etags)) or (res_etag and (res_etag not in etags)))):
                    response = HttpResponse(status=412)
                elif ((not if_none_match) and if_modified_since and (request.method == 'GET') and (res_last_modified == if_modified_since)):
                    response = HttpResponseNotModified()
            if (response is None):
                response = func(request, *args, **kwargs)
            if (res_last_modified and (not...