human
Complete the below
def document_etag(value, ignore_fields=None):

    ''''Computes and returns a valid ETag for the input value.
    :param value: the value to compute the ETag with.
    :param ignore_fields: `ignore_fields` list of fields to skip to
    compute the ETag value.
    .. versionchanged:: 0.5.4
    Use json_encoder_class. See #624.
    .. versionchanged:: 0.0.4
    Using bson.json_util.dumps over str(value) to make etag computation
    consistent between different runs and/or server instances (#16).'
    '''
assistant
#Here is Python code to compute the ETag with.
    if ignore_fields:
        def filter_ignore_fields(d, fields):
            for field in fields:
                (key, _, value) = field.partition('.')
                if value:
                    filter_ignore_fields(d[key], [value])
                elif (field in d):
                    d.pop(field)
                else:
                    pass
        value_ = copy(value)
        filter_ignore_fields(value_, ignore_fields)
    else:
        value_ = value
    h = hashlib.sha1()
    json_encoder = app.data.json_encoder_class()
    h.update(dumps(value_, sort_keys=True, default=json_encoder.default).encode('utf-8'))
    return h.hexdigest()