def record_response(self, answer, rationale, status):
answers = self.get_answers_for_student()<EOL>stats = self.get_current_stats()<EOL>truncated_rationale, was_truncated = truncate_rationale(rationale)<EOL>corr_ans_text = '<STR_LIT>'<EOL>if self.correct_answer == len(self.options):    <EOL><INDENT>corr_ans_text = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>corr_ans_text = self.options[self.correct_answer].get('<STR_LIT:text>'),<EOL><DEDENT>event_dict = {<EOL>'<STR_LIT>': answer,<EOL>'<STR_LIT>': self.options[answer].get('<STR_LIT:text>'),<EOL>'<STR_LIT>': truncated_rationale,<EOL>'<STR_LIT>': self.correct_answer,<EOL>'<STR_LIT>': corr_ans_text,<EOL>'<STR_LIT>': self.correct_rationale,<EOL>'<STR_LIT>': was_truncated<EOL>}<EOL>if not answers.has_revision(<NUM_LIT:0>) and status == STATUS_NEW:<EOL><INDENT>student_item = self.get_student_item_dict()<EOL>sas_api.add_answer_for_student(student_item, answer, rationale)<EOL>num_resp = stats['<STR_LIT>'].setdefault(answer, <NUM_LIT:0>)<EOL>stats['<STR_LIT>'][answer] = num_resp + <NUM_LIT:1><EOL>offer_answer(<EOL>self.sys_selected_answers, answer, rationale,<EOL>student_item['<STR_LIT>'], self.algo, self.options)<EOL>self.other_answers_shown = get_other_answers(<EOL>self.sys_selected_answers, self.seeds, self.get_student_item_dict, self.algo, self.options)<EOL>event_dict['<STR_LIT>'] = self.other_answers_shown<EOL>self.publish_event_from_dict(<EOL>self.event_namespace + '<STR_LIT>',<EOL>event_dict<EOL>)<EOL>return event_dict['<STR_LIT>']<EOL><DEDENT>elif answers.has_revision(<NUM_LIT:0>) and not answers.has_revision(<NUM_LIT:1>) and status == STATUS_ANSWERED:<EOL><INDENT>sas_api.add_answer_for_student(self.get_student_item_dict(), answer, rationale)<EOL>num_resp = stats['<STR_LIT>'].setdefault(answer, <NUM_LIT:0>)<EOL>stats['<STR_LIT>'][answer] = num_resp + <NUM_LIT:1><EOL>grade = self.get_grade()<EOL>self.runtime.publish(self, '<STR_LIT>', {'<STR_LIT:value>': grade, '<STR_LIT>': <NUM_LIT:1>})<EOL>self.publish_event_from_dict(<EOL>self.event_namespace + '<STR_LIT>',<EOL>event_dict<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise PermissionDenied<EOL><DEDENT>
Store response from student to the backend

Args:
    answer (int): the option index that student responded
    rationale (str): the rationale text
    status (int): the progress status for this student. Possible values are:
        STATUS_NEW, STATUS_ANSWERED, STATUS_REVISED

Raises:
    PermissionDenied: if we got an invalid status