Lines 93-94 would never be called since get_course_by_id never returns None.  It will raise the Http404 error itself, so we can remove these lines.