def get_edxml(self):
if self.has_raw_edxml():<EOL><INDENT>has_python = False<EOL>my_files = self.my_osid_object.object_map['<STR_LIT>']<EOL>raw_text = self.get_text('<STR_LIT>').text<EOL>soup = BeautifulSoup(raw_text, '<STR_LIT>')<EOL>attrs = {<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT:src>'<EOL>}<EOL>local_regex = re.compile('<STR_LIT>')<EOL>for key, attr in attrs.items():<EOL><INDENT>search = {attr: local_regex}<EOL>tags = soup.find_all(**search)<EOL>for item in tags:<EOL><INDENT>if key == '<STR_LIT>' or item.name == key:<EOL><INDENT>file_label = self._clean(item[attr])<EOL>if file_label in my_files:<EOL><INDENT>content_type = Id(my_files[file_label]['<STR_LIT>'])<EOL>item[attr] = '<STR_LIT>' + file_label + '<STR_LIT:.>' +content_type.get_identifier()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if len(soup.find_all('<STR_LIT>')) >= <NUM_LIT:1>:<EOL><INDENT>scripts = soup.find_all('<STR_LIT>')<EOL>for script in scripts:<EOL><INDENT>if '<STR_LIT>' in script['<STR_LIT:type>']:<EOL><INDENT>has_python = True<EOL>break<EOL><DEDENT><DEDENT><DEDENT>try:<EOL><INDENT>if has_python:<EOL><INDENT>return str(soup.find('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>return soup.find('<STR_LIT>').prettify()<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>return self.get_text('<STR_LIT>').text<EOL><DEDENT><DEDENT>else:<EOL><INDENT>obj_map = self.my_osid_object.object_map<EOL>question = obj_map['<STR_LIT>']<EOL>answers = obj_map['<STR_LIT>']<EOL>if '<STR_LIT>' in obj_map['<STR_LIT>']:<EOL><INDENT>answer_ids = []<EOL>for answer in answers:<EOL><INDENT>answer_ids += answer['<STR_LIT>']<EOL><DEDENT>soup = BeautifulSoup('<STR_LIT>', '<STR_LIT>')<EOL>p = soup.new_tag('<STR_LIT:p>')<EOL>p.string = self.get_text('<STR_LIT>').text<EOL>problem = soup.find('<STR_LIT>')<EOL>problem.append(p)<EOL>problem['<STR_LIT>'] = question['<STR_LIT>']['<STR_LIT:text>']<EOL>problem['<STR_LIT>'] = self.showanswer<EOL>if '<STR_LIT>' in obj_map:<EOL><INDENT>problem['<STR_LIT>'] = obj_map['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in question:<EOL><INDENT>problem['<STR_LIT>'] = question['<STR_LIT>']<EOL><DEDENT>problem['<STR_LIT>'] = self.attempts<EOL>multichoice = soup.new_tag('<STR_LIT>')<EOL>problem.append(multichoice)<EOL>choicegroup = soup.new_tag('<STR_LIT>')<EOL>choicegroup['<STR_LIT>'] = '<STR_LIT>'<EOL>multichoice.append(choicegroup)<EOL>choices = question['<STR_LIT>']<EOL>for choice in choices:<EOL><INDENT>new_choice = soup.new_tag('<STR_LIT>')<EOL>if choice['<STR_LIT:id>'] in answer_ids:<EOL><INDENT>new_choice['<STR_LIT>'] = '<STR_LIT:true>'<EOL><DEDENT>else:<EOL><INDENT>new_choice['<STR_LIT>'] = '<STR_LIT:false>'<EOL><DEDENT>new_choice['<STR_LIT:name>'] = choice['<STR_LIT:name>']<EOL>choice_text = soup.new_tag('<STR_LIT:text>')<EOL>choice_text.string = choice['<STR_LIT:text>']<EOL>new_choice.append(choice_text)<EOL>choicegroup.append(new_choice)<EOL><DEDENT>return problem.prettify()<EOL><DEDENT><DEDENT>raise IllegalState('<STR_LIT>')<EOL>
stub