'Decorator responsible for catching errors finding and returning a 404 if the user does not have access
to the API function.
:param func: function to be wrapped
:returns: the wrapped function'

@staticmethod
def course_check(func):

    def func_wrapper(self, *args, **kwargs):
        'Wrapper    function    for    this    decorator.\n\n                                                :param    *args:    the    arguments    passed    into    the    function\n                                                :param    **kwargs:    the    keyword    arguments    passed    into    the    function\n                                                :returns:    the    result    of    the    wrapped    function\n                                                '
        try:
            course_id = self.kwargs.get('course_id')
            self.course_key = CourseKey.from_string(course_id)
            self.check_course_permissions(self.request.user, self.course_key)
            return func(self, *args, **kwargs)
        except CourseNotFoundError:
            raise Http404
    return func_wrapper
