human
Complete the below
def check_accept(*types):

    ''''If accept is set explicitly, try to follow it.
    If there is no match for the incoming accept header
    send a 406 response code.
    If accept is not set send our usual content-type in
    response.'
    '''
assistant
#Here is the Python code you requested.
    def decorator(f):
        @functools.wraps(f)
        def decorated_function(req):
            if req.accept:
                best_match = req.accept.best_match(types)
                if (not best_match):
                    type_string = ',    '.join(types)
                    raise webob.exc.HTTPNotAcceptable((_('Only    %(type)s    is    provided') % {'type': type_string}), json_formatter=json_error_formatter)
            return f(req)
        return decorated_function
    return decorator