def convert_branch(self, old_node, new_node, comment_dict=None):
expected_tag = '<STR_LIT>'<EOL>if old_node.tag != expected_tag:<EOL><INDENT>raise UpgradeError('<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.tag == '<STR_LIT>':<EOL><INDENT>condition = node.get('<STR_LIT>')<EOL>negation = False<EOL>if condition.endswith('<STR_LIT>'):<EOL><INDENT>negation = True<EOL>condition = condition[:-<NUM_LIT:3>]<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>negate=negation,<EOL>nid=node_id)<EOL>comment = node.find('<STR_LIT>')<EOL>if comment is not None:<EOL><INDENT>comment_dict[node_id] = comment.text<EOL><DEDENT>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 UpgradeError('<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, comment_dict)<EOL><DEDENT>else:<EOL><INDENT>raise UpgradeError('<STR_LIT>')<EOL><DEDENT><DEDENT>return True<EOL>
recursively walk a indicator logic tree, starting from a Indicator node.
converts OpenIOC 1.0 Indicator/IndicatorItems to Openioc 1.1 and preserves order.

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