def convert_branch(self, old_node, new_node, ids_to_skip, comment_dict=None):
expected_tag = '<STR_LIT>'<EOL>if old_node.tag != expected_tag:<EOL><INDENT>raise DowngradeError('<STR_LIT>' % expected_tag)<EOL><DEDENT>if not comment_dict:<EOL><INDENT>comment_dict = {}<EOL><DEDENT>for node in old_node.getchildren():<EOL><INDENT>node_id = node.get('<STR_LIT:id>')<EOL>if node_id in ids_to_skip:<EOL><INDENT>continue<EOL><DEDENT>if node.tag == '<STR_LIT>':<EOL><INDENT>negation = node.get('<STR_LIT>')<EOL>condition = node.get('<STR_LIT>')<EOL>if '<STR_LIT:true>' in negation.lower():<EOL><INDENT>new_condition = condition + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>new_condition = condition<EOL><DEDENT>document = node.xpath('<STR_LIT>')[<NUM_LIT:0>]<EOL>search = node.xpath('<STR_LIT>')[<NUM_LIT:0>]<EOL>content_type = node.xpath('<STR_LIT>')[<NUM_LIT:0>]<EOL>content = node.findtext('<STR_LIT>')<EOL>context_type = node.xpath('<STR_LIT>')[<NUM_LIT:0>]<EOL>new_ii_node = ioc_api.make_indicatoritem_node(condition=condition,<EOL>document=document,<EOL>search=search,<EOL>content_type=content_type,<EOL>content=content,<EOL>context_type=context_type,<EOL>nid=node_id)<EOL>new_ii_node.attrib['<STR_LIT>'] = new_condition<EOL>if node_id in comment_dict:<EOL><INDENT>comment = comment_dict[node_id]<EOL>comment_node = et.Element('<STR_LIT>')<EOL>comment_node.text = comment<EOL>new_ii_node.append(comment_node)<EOL><DEDENT>del new_ii_node.attrib['<STR_LIT>']<EOL>del new_ii_node.attrib['<STR_LIT>']<EOL>new_node.append(new_ii_node)<EOL><DEDENT>elif node.tag == '<STR_LIT>':<EOL><INDENT>operator = node.get('<STR_LIT>')<EOL>if operator.upper() not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise DowngradeError('<STR_LIT>' % (node_id, operator))<EOL><DEDENT>new_i_node = ioc_api.make_indicator_node(operator, node_id)<EOL>new_node.append(new_i_node)<EOL>self.convert_branch(node, new_i_node, ids_to_skip, comment_dict)<EOL><DEDENT>else:<EOL><INDENT>raise DowngradeError('<STR_LIT>')<EOL><DEDENT><DEDENT>return True<EOL>
Recursively walk a indicator logic tree, starting from a Indicator node.
Converts OpenIOC 1.1 Indicator/IndicatorItems to Openioc 1.0 and preserves order.


:param old_node: An Indicator node, which we walk down to convert
:param new_node: An Indicator node, which we add new IndicatorItem and Indicator nodes too
:param ids_to_skip: set of node @id values not to convert
:param comment_dict: maps ids to comment values.  only applied to IndicatorItem nodes
:return: returns True upon completion.
:raises: DowngradeError if there is a problem during the conversion.