def convert_to_10(self):
if len(self) < <NUM_LIT:1>:<EOL><INDENT>log.error('<STR_LIT>')<EOL>return False<EOL><DEDENT>log.info('<STR_LIT>')<EOL>errors = []<EOL>for iocid in self.iocs:<EOL><INDENT>pruned = False<EOL>ioc_obj_11 = self.iocs[iocid]<EOL>metadata = ioc_obj_11.metadata<EOL>name_11 = metadata.findtext('<STR_LIT>')<EOL>keywords_11 = metadata.findtext('<STR_LIT>')<EOL>description_11 = metadata.findtext('<STR_LIT>')<EOL>author_11 = metadata.findtext('<STR_LIT>')<EOL>created_date_11 = metadata.findtext('<STR_LIT>')<EOL>last_modified_date_11 = ioc_obj_11.root.get('<STR_LIT>')<EOL>links_11 = []<EOL>for link in metadata.xpath('<STR_LIT>'):<EOL><INDENT>link_rel = link.get('<STR_LIT>')<EOL>link_text = link.text<EOL>links_11.append((link_rel, None, link_text))<EOL><DEDENT>try:<EOL><INDENT>ioc_logic = ioc_obj_11.root.xpath('<STR_LIT>')[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>log.exception(<EOL>'<STR_LIT>'.format(<EOL>iocid))<EOL>errors.append(iocid)<EOL>continue<EOL><DEDENT>try:<EOL><INDENT>tlo_11 = ioc_logic.getchildren()[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>log.exception(<EOL>'<STR_LIT>'.format(iocid))<EOL>errors.append(iocid)<EOL>continue<EOL><DEDENT>tlo_id = tlo_11.get('<STR_LIT:id>')<EOL>comment_dict = {}<EOL>for param in ioc_obj_11.parameters.xpath('<STR_LIT>'):<EOL><INDENT>param_id = param.get('<STR_LIT>')<EOL>param_text = param.findtext('<STR_LIT:value>')<EOL>comment_dict[param_id] = param_text<EOL><DEDENT>ioc_obj_10 = ioc_api.IOC(name=name_11, description=description_11, author=author_11, links=links_11,<EOL>keywords=keywords_11, iocid=iocid)<EOL>ioc_obj_10.root.attrib['<STR_LIT>'] = last_modified_date_11<EOL>authored_date_node = ioc_obj_10.metadata.find('<STR_LIT>')<EOL>authored_date_node.text = created_date_11<EOL>ioc_obj_10.root.attrib['<STR_LIT>'] = '<STR_LIT>'<EOL>del ioc_obj_10.root.attrib['<STR_LIT>']<EOL>ioc_obj_10.root.remove(ioc_obj_10.parameters)<EOL>ioc_obj_10.root.tag = '<STR_LIT>'<EOL>metadata_node = ioc_obj_10.metadata<EOL>criteria_node = ioc_obj_10.top_level_indicator.getparent()<EOL>metadata_dictionary = {}<EOL>for child in metadata_node:<EOL><INDENT>metadata_dictionary[child.tag] = child<EOL><DEDENT>for tag in METADATA_REQUIRED_10:<EOL><INDENT>if tag not in metadata_dictionary:<EOL><INDENT>msg = '<STR_LIT>'.format(iocid, tag)<EOL>raise DowngradeError(msg)<EOL><DEDENT><DEDENT>for tag in METADATA_ORDER_10:<EOL><INDENT>if tag in metadata_dictionary:<EOL><INDENT>ioc_obj_10.root.append(metadata_dictionary.get(tag))<EOL><DEDENT><DEDENT>ioc_obj_10.root.remove(metadata_node)<EOL>ioc_obj_10.root.remove(criteria_node)<EOL>criteria_node.tag = '<STR_LIT>'<EOL>ioc_obj_10.root.append(criteria_node)<EOL>ioc_obj_10.top_level_indicator.attrib['<STR_LIT:id>'] = tlo_id<EOL>ids_to_skip = set()<EOL>indicatoritems_to_remove = set()<EOL>for condition_type in self.openioc_11_only_conditions:<EOL><INDENT>for elem in ioc_logic.xpath('<STR_LIT>' % condition_type):<EOL><INDENT>pruned = True<EOL>indicatoritems_to_remove.add(elem)<EOL><DEDENT><DEDENT>for elem in ioc_logic.xpath('<STR_LIT>'):<EOL><INDENT>pruned = True<EOL>indicatoritems_to_remove.add(elem)<EOL><DEDENT>for elem in indicatoritems_to_remove:<EOL><INDENT>nid = None<EOL>current = elem<EOL>while nid != tlo_id:<EOL><INDENT>parent = current.getparent()<EOL>nid = parent.get('<STR_LIT:id>')<EOL>if nid == tlo_id:<EOL><INDENT>current_id = current.get('<STR_LIT:id>')<EOL>ids_to_skip.add(current_id)<EOL><DEDENT>else:<EOL><INDENT>current = parent<EOL><DEDENT><DEDENT><DEDENT>try:<EOL><INDENT>self.convert_branch(tlo_11, ioc_obj_10.top_level_indicator, ids_to_skip, comment_dict)<EOL><DEDENT>except DowngradeError:<EOL><INDENT>log.exception('<STR_LIT>'.format(iocid))<EOL>errors.append(iocid)<EOL>continue<EOL><DEDENT>except Exception:<EOL><INDENT>log.exception('<STR_LIT>'.format(iocid))<EOL>errors.append(iocid)<EOL>continue<EOL><DEDENT>if not ioc_obj_10.top_level_indicator.getchildren():<EOL><INDENT>self.null_pruned_iocs.add(iocid)<EOL><DEDENT>elif pruned is True:<EOL><INDENT>self.pruned_11_iocs.add(iocid)<EOL><DEDENT>comment_node = ioc_obj_11.root.getprevious()<EOL>while comment_node is not None:<EOL><INDENT>log.debug('<STR_LIT>')<EOL>c = et.Comment(comment_node.text)<EOL>ioc_obj_10.root.addprevious(c)<EOL>comment_node = comment_node.getprevious()<EOL><DEDENT>self.iocs_10[iocid] = ioc_obj_10<EOL><DEDENT>return errors<EOL>
converts the iocs in self.iocs from openioc 1.1 to openioc 1.0 format.
the converted iocs are stored in the dictionary self.iocs_10
:return: A list of iocid values which had errors downgrading.