code: def get_course_and_check_rights(self, courseid, taskid=None, allow_all_staff=True):
          
  
          try:
              course = self.course_factory.get_course(courseid)
              if allow_all_staff:
                  if not self.user_manager.has_staff_rights_on_course(course):
                      raise web.notfound()
              else:
                  if not self.user_manager.has_admin_rights_on_course(course):
                      raise web.notfound()
  
              if taskid is None:
                  return course, None
              else:
                  return course, course.get_task(taskid)
          except:
              raise web.notfound()
docs: Returns the course with id ``courseid`` and the task with id ``taskid``, and verify the rights of the user.
              Raise web.notfound() when there is no such course of if the users has not enough rights.
  
              :param courseid: the course on which to check rights
              :param taskid: If not None, returns also the task with id ``taskid``
              :param allow_all_staff: allow admins AND tutors to see the page. If false, all only admins.
              :returns (Course, Task)