nodes: 0, module; 1, function_definition; 2, function_name:iterate_flattened_separately; 3, parameters; 4, block; 5, identifier:dictionary; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, for_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, for_statement; 14, identifier:manually_sorted_keys; 15, None; 16, comment:"""
      Recursively iterate over the items of a dictionary in a special order.
  
      First iterate over manually sorted keys and then over all items that are
      non-dictionary values (sorted by keys), then over the rest
      (sorted by keys), providing full dotted paths for every leaf.
      """; 17, comparison_operator:manually_sorted_keys is None; 18, block; 19, identifier:key; 20, identifier:manually_sorted_keys; 21, block; 22, assignment; 23, identifier:key; 24, call; 25, block; 26, assignment; 27, identifier:key; 28, call; 29, block; 30, identifier:manually_sorted_keys; 31, None; 32, expression_statement; 33, if_statement; 34, identifier:single_line_keys; 35, list_comprehension; 36, identifier:sorted; 37, argument_list; 38, expression_statement; 39, identifier:multi_line_keys; 40, list_comprehension; 41, identifier:sorted; 42, argument_list; 43, expression_statement; 44, for_statement; 45, assignment; 46, comparison_operator:key in dictionary; 47, block; 48, identifier:key; 49, for_in_clause; 50, if_clause; 51, identifier:single_line_keys; 52, yield; 53, identifier:key; 54, for_in_clause; 55, if_clause; 56, identifier:multi_line_keys; 57, yield; 58, pattern_list; 59, call; 60, block; 61, identifier:manually_sorted_keys; 62, list; 63, identifier:key; 64, identifier:dictionary; 65, expression_statement; 66, identifier:key; 67, call; 68, boolean_operator; 69, expression_list; 70, identifier:key; 71, call; 72, boolean_operator; 73, expression_list; 74, identifier:k; 75, identifier:val; 76, identifier:iterate_flattened_separately; 77, argument_list; 78, expression_statement; 79, yield; 80, attribute; 81, argument_list; 82, comparison_operator:key not in manually_sorted_keys; 83, parenthesized_expression; 84, identifier:key; 85, subscript; 86, attribute; 87, argument_list; 88, comparison_operator:key not in manually_sorted_keys; 89, parenthesized_expression; 90, identifier:key; 91, identifier:PATHCHANGE; 92, subscript; 93, identifier:manually_sorted_keys; 94, yield; 95, expression_list; 96, identifier:dictionary; 97, identifier:keys; 98, identifier:key; 99, identifier:manually_sorted_keys; 100, boolean_operator; 101, identifier:dictionary; 102, identifier:key; 103, identifier:dictionary; 104, identifier:keys; 105, identifier:key; 106, identifier:manually_sorted_keys; 107, boolean_operator; 108, identifier:dictionary; 109, identifier:key; 110, expression_list; 111, identifier:key; 112, subscript; 113, not_operator; 114, not_operator; 115, subscript; 116, call; 117, call; 118, identifier:val; 119, identifier:dictionary; 120, identifier:key; 121, subscript; 122, call; 123, identifier:dictionary; 124, identifier:key; 125, identifier:isinstance; 126, argument_list; 127, identifier:join_paths; 128, argument_list; 129, identifier:dictionary; 130, identifier:key; 131, identifier:isinstance; 132, argument_list; 133, subscript; 134, identifier:dict; 135, identifier:key; 136, identifier:k; 137, subscript; 138, identifier:dict; 139, identifier:dictionary; 140, identifier:key; 141, identifier:dictionary; 142, identifier:key
code: def iterate_flattened_separately(dictionary, manually_sorted_keys=None):
      """
      Recursively iterate over the items of a dictionary in a special order.
  
      First iterate over manually sorted keys and then over all items that are
      non-dictionary values (sorted by keys), then over the rest
      (sorted by keys), providing full dotted paths for every leaf.
      """
      if manually_sorted_keys is None:
          manually_sorted_keys = []
      for key in manually_sorted_keys:
          if key in dictionary:
              yield key, dictionary[key]
  
      single_line_keys = [key for key in dictionary.keys() if
                          key not in manually_sorted_keys and
                          (not dictionary[key] or
                           not isinstance(dictionary[key], dict))]
      for key in sorted(single_line_keys):
          yield key, dictionary[key]
  
      multi_line_keys = [key for key in dictionary.keys() if
                         key not in manually_sorted_keys and
                         (dictionary[key] and
                          isinstance(dictionary[key], dict))]
      for key in sorted(multi_line_keys):
          yield key, PATHCHANGE
          for k, val in iterate_flattened_separately(dictionary[key],
                                                     manually_sorted_keys):
              yield join_paths(key, k), val