human
I wrote the below code

    @functools.wraps(func)
    def wrapper(request, *args, **kwargs):
        '\n                                Wrapper    for    the    view    that    only    calls    the    view    if    the    user    is    authorized.\n                                '
        def fetch_content():
            '\n                                                Extract    the    forum    object    from    the    keyword    arguments    to    the    view.\n                                                '
            user_group_id = None
            content_user_group_id = None
            if ('thread_id' in kwargs):
                content = cc.Thread.find(kwargs['thread_id']).to_dict()
            elif ('comment_id' in kwargs):
                content = cc.Comment.find(kwargs['comment_id']).to_dict()
            elif ('commentable_id' in kwargs):
                content = cc.Commentable.find(kwargs['commentable_id']).to_dict()
            else:
                content = None
            if ('username' in content):
                (user_group_id, content_user_group_id) = get_user_group_ids(course_key, content, request.user)
            return (content, user_group_id, content_user_group_id)
        course_key = CourseKey.from_string(kwargs['course_id'])
        (content, user_group_id, content_user_group_id) = fetch_content()
        if check_permissions_by_view(request.user, course_key, content, request.view_name, user_group_id, content_user_group_id):
            return func(request, *args, **kwargs)
        else:
            return JsonError('unauthorized', status=401)
    return wrapper

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def permitted(func):