def _get_question_by_id(self, level_list, qid, prev_levels=None):
    level = Level(level_list)
    if (prev_levels is not None):
        prev_levels.change_level(level)
    else:
        prev_levels = Levels([level])
    for item in level_list:
        prev_levels.level.incr()
        if (type(item) == dict):
            if ((item.get(ID) == qid) and item.get(ACTION)):
                return {'levels': prev_levels, 'item': item}
            else:
                for key in item:
                    if ((key == ON_NO) or (key == ON_YES)):
                        result = self._get_question_by_id(item[key], qid, prev_levels)
                        if (result is not None):
                            return result
                    elif (key == ON_CHOICES):
                        for choice in item[key]:
                            result = self._get_question_by_id(item[key][choice], qid, prev_levels)
                            if (result is not None):
                                return result
def _get_question_by_id(self, level_list, qid, prev_levels=None):
    level = Level(level_list)
    if (prev_levels is not None):
        prev_levels.change_level(level)
    else:
        prev_levels = Levels([level])
    for item in level_list:
        prev_levels.level.incr()
        if (type(item) == dict):
            if ((item.get(ID) == qid) and item.get(ACTION)):
                return {'levels': prev_levels, 'item': item}
            else:
                for key in item:
                    if ((key == ON_NO) or (key == ON_YES)):
                        result = self._get_question_by_id(item[key], qid, prev_levels)
                        if (result is not None):
                            return result
                    elif (key == ON_CHOICES):
                        for choice in item[key]:
                            result = self._get_question_by_id(item[key][choice], qid, prev_levels)
                            if (result is not None):
                                return result