nodes: 0, module; 1, function_definition; 2, function_name:insert_sort; 3, parameters; 4, block; 5, identifier:node; 6, identifier:target; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Insert node into sorted position in target tree.
  
      Uses sort function and language from target"""; 13, assignment; 14, assignment; 15, assignment; 16, identifier:child; 17, attribute; 18, block; 19, else_clause; 20, identifier:sort; 21, attribute; 22, identifier:lang; 23, attribute; 24, identifier:collator; 25, call; 26, identifier:target; 27, identifier:tree; 28, if_statement; 29, block; 30, identifier:target; 31, identifier:sort; 32, identifier:target; 33, identifier:lang; 34, attribute; 35, argument_list; 36, comparison_operator:collator.compare(sort(child) or '', sort(node) or '') > 0; 37, block; 38, expression_statement; 39, identifier:Collator; 40, identifier:createInstance; 41, conditional_expression:Locale(lang) if lang else Locale(); 42, call; 43, integer:0; 44, expression_statement; 45, break_statement; 46, call; 47, call; 48, identifier:lang; 49, call; 50, attribute; 51, argument_list; 52, call; 53, attribute; 54, argument_list; 55, identifier:Locale; 56, argument_list; 57, identifier:Locale; 58, argument_list; 59, identifier:collator; 60, identifier:compare; 61, boolean_operator; 62, boolean_operator; 63, attribute; 64, argument_list; 65, attribute; 66, identifier:append; 67, identifier:node; 68, identifier:lang; 69, call; 70, string; 71, call; 72, string; 73, identifier:child; 74, identifier:addprevious; 75, identifier:node; 76, identifier:target; 77, identifier:tree; 78, identifier:sort; 79, argument_list; 80, identifier:sort; 81, argument_list; 82, identifier:child; 83, identifier:node
code: def insert_sort(node, target):
      """Insert node into sorted position in target tree.
  
      Uses sort function and language from target"""
      sort = target.sort
      lang = target.lang
      collator = Collator.createInstance(Locale(lang) if lang else Locale())
      for child in target.tree:
          if collator.compare(sort(child) or '', sort(node) or '') > 0:
              child.addprevious(node)
              break
      else:
          target.tree.append(node)