nodes: 0, module; 1, function_definition; 2, function_name:make_node_dict; 3, parameters; 4, block; 5, identifier:outer_list; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; 15, return_statement; 16, identifier:sort; 17, string:"zone"; 18, comment:"""Convert node data from nested-list to sorted dict."""; 19, assignment; 20, assignment; 21, identifier:inner_list; 22, identifier:outer_list; 23, block; 24, comparison_operator:sort == "name"; 25, comment:# sort by provider - name; 26, block; 27, else_clause; 28, assignment; 29, assignment; 30, pattern_list; 31, call; 32, block; 33, identifier:node_dict; 34, identifier:raw_dict; 35, dictionary; 36, identifier:x; 37, integer:1; 38, for_statement; 39, identifier:sort; 40, string:"name"; 41, expression_statement; 42, comment:# sort by provider - zone - name; 43, block; 44, identifier:x; 45, integer:1; 46, identifier:node_dict; 47, dictionary; 48, identifier:i; 49, identifier:v; 50, attribute; 51, argument_list; 52, expression_statement; 53, expression_statement; 54, identifier:node; 55, identifier:inner_list; 56, block; 57, assignment; 58, expression_statement; 59, identifier:srt_dict; 60, identifier:items; 61, assignment; 62, augmented_assignment; 63, expression_statement; 64, expression_statement; 65, identifier:srt_dict; 66, call; 67, assignment; 68, subscript; 69, identifier:v; 70, identifier:x; 71, integer:1; 72, assignment; 73, augmented_assignment; 74, identifier:OrderedDict; 75, argument_list; 76, identifier:srt_dict; 77, call; 78, identifier:node_dict; 79, identifier:x; 80, subscript; 81, identifier:node; 82, identifier:x; 83, integer:1; 84, call; 85, identifier:OrderedDict; 86, argument_list; 87, identifier:raw_dict; 88, identifier:x; 89, identifier:sorted; 90, argument_list; 91, call; 92, call; 93, keyword_argument; 94, identifier:sorted; 95, argument_list; 96, attribute; 97, argument_list; 98, identifier:key; 99, lambda; 100, call; 101, keyword_argument; 102, identifier:raw_dict; 103, identifier:items; 104, lambda_parameters; 105, tuple; 106, attribute; 107, argument_list; 108, identifier:key; 109, lambda; 110, identifier:k; 111, attribute; 112, call; 113, identifier:raw_dict; 114, identifier:items; 115, lambda_parameters; 116, tuple; 117, subscript; 118, identifier:cloud; 119, attribute; 120, argument_list; 121, identifier:k; 122, attribute; 123, attribute; 124, call; 125, identifier:k; 126, integer:1; 127, attribute; 128, identifier:lower; 129, subscript; 130, identifier:cloud; 131, subscript; 132, identifier:zone; 133, attribute; 134, argument_list; 135, subscript; 136, identifier:name; 137, identifier:k; 138, integer:1; 139, identifier:k; 140, integer:1; 141, attribute; 142, identifier:lower; 143, identifier:k; 144, integer:1; 145, subscript; 146, identifier:name; 147, identifier:k; 148, integer:1
code: def make_node_dict(outer_list, sort="zone"):
      """Convert node data from nested-list to sorted dict."""
      raw_dict = {}
      x = 1
      for inner_list in outer_list:
          for node in inner_list:
              raw_dict[x] = node
              x += 1
      if sort == "name":  # sort by provider - name
          srt_dict = OrderedDict(sorted(raw_dict.items(), key=lambda k:
                                 (k[1].cloud, k[1].name.lower())))
      else:  # sort by provider - zone - name
          srt_dict = OrderedDict(sorted(raw_dict.items(), key=lambda k:
                                 (k[1].cloud, k[1].zone, k[1].name.lower())))
      x = 1
      node_dict = {}
      for i, v in srt_dict.items():
          node_dict[x] = v
          x += 1
      return node_dict