def get_next_question(self, question_id, answered=None, reverse=False, honor_sequential=True):
self._update_questions()  <EOL>question_map = self._get_question_map(question_id)  <EOL>questions = list(self._my_map['<STR_LIT>'])<EOL>if reverse:<EOL><INDENT>questions = questions[::-<NUM_LIT:1>]<EOL>error_text = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>if '<STR_LIT>' in question_map:<EOL><INDENT>if self._is_question_sequential(question_map) and honor_sequential:<EOL><INDENT>raise errors.IllegalState('<STR_LIT>')<EOL><DEDENT><DEDENT>error_text = '<STR_LIT>'<EOL><DEDENT>if questions[-<NUM_LIT:1>] == question_map:<EOL><INDENT>raise errors.IllegalState('<STR_LIT>' + error_text + '<STR_LIT>')<EOL><DEDENT>index = questions.index(question_map) + <NUM_LIT:1><EOL>for question_map in questions[index:]:<EOL><INDENT>latest_question_response = question_map['<STR_LIT>'][<NUM_LIT:0>]<EOL>question_answered = False<EOL>if '<STR_LIT>' not in latest_question_response:<EOL><INDENT>question_answered = True<EOL><DEDENT>if answered is None or question_answered == answered:<EOL><INDENT>return self.get_question(question_map=question_map)<EOL><DEDENT><DEDENT>raise errors.IllegalState('<STR_LIT>' + error_text + '<STR_LIT>')<EOL>
Inspects question map to return the next available question.

        if answered == False: only return next unanswered question
        if answered == True: only return next answered question
        if answered in None: return next question whether answered or not
        if reverse == True: go backwards - effectively get_previous_question
        if honor_sequential == True: only return questions if section or part
                                     is set to sequential items