def parse_from_xml(root):
<EOL>if root.tag != '<STR_LIT>':<EOL><INDENT>raise UpdateFromXmlError(_('<STR_LIT>'))<EOL><DEDENT>display_name_el = root.find('<STR_LIT>')<EOL>if display_name_el is None:<EOL><INDENT>raise UpdateFromXmlError(_('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>display_name = _safe_get_text(display_name_el)<EOL><DEDENT>rationale_size_min = int(root.attrib['<STR_LIT>']) if '<STR_LIT>' in root.attrib else None<EOL>rationale_size_max = int(root.attrib['<STR_LIT>']) if '<STR_LIT>' in root.attrib else None<EOL>question_el = root.find('<STR_LIT>')<EOL>if question_el is None:<EOL><INDENT>raise UpdateFromXmlError(_('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>question = parse_question_xml(question_el)<EOL><DEDENT>options_el = root.find('<STR_LIT>')<EOL>if options_el is None:<EOL><INDENT>raise UpdateFromXmlError(_('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>options, correct_answer, correct_rationale = parse_options_xml(options_el)<EOL><DEDENT>seeds_el = root.find('<STR_LIT>')<EOL>if seeds_el is None:<EOL><INDENT>raise UpdateFromXmlError(_('<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>seeds = parse_seeds_xml(seeds_el)<EOL><DEDENT>algo = unicode(root.attrib['<STR_LIT>']) if '<STR_LIT>' in root.attrib else None<EOL>num_responses = unicode(root.attrib['<STR_LIT>']) if '<STR_LIT>' in root.attrib else None<EOL>return {<EOL>'<STR_LIT>': display_name,<EOL>'<STR_LIT>': question,<EOL>'<STR_LIT>': options,<EOL>'<STR_LIT>': {'<STR_LIT>': rationale_size_min, '<STR_LIT>': rationale_size_max},<EOL>'<STR_LIT>': correct_answer,<EOL>'<STR_LIT>': correct_rationale,<EOL>'<STR_LIT>': seeds,<EOL>'<STR_LIT>': {"<STR_LIT:name>": algo, '<STR_LIT>': num_responses}<EOL>}<EOL>
Update the UBCPI XBlock's content from an XML definition.

We need to be strict about the XML we accept, to avoid setting
the XBlock to an invalid state (which will then be persisted).

Args:
    root (lxml.etree.Element): The XML definition of the XBlock's content.

Returns:
    A dictionary of all of the XBlock's content.

Raises:
    UpdateFromXmlError: The XML definition is invalid