code: def _create_task_problem(self, problemid, problem_content, task_problem_types):
          
          # Basic checks
          if not id_checker(problemid):
              raise Exception("Invalid problem _id: " + problemid)
          if problem_content.get('type', "") not in task_problem_types:
              raise Exception("Invalid type for problem " + problemid)
  
          return task_problem_types.get(problem_content.get('type', ""))(self, problemid, problem_content, self._translations)
docs: Creates a new instance of the right class for a given problem.