nodes: 0, module; 1, function_definition; 2, function_name:zunionstore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:destkey; 7, identifier:key; 8, list_splat_pattern; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, if_statement; 16, if_statement; 17, expression_statement; 18, return_statement; 19, identifier:keys; 20, identifier:with_weights; 21, False; 22, identifier:aggregate; 23, None; 24, comment:"""Add multiple sorted sets and store result in a new key."""; 25, assignment; 26, assignment; 27, assignment; 28, identifier:with_weights; 29, block; 30, else_clause; 31, comparison_operator:aggregate is self.ZSET_AGGREGATE_SUM; 32, block; 33, elif_clause; 34, elif_clause; 35, assignment; 36, identifier:fut; 37, identifier:keys; 38, binary_operator:(key,) + keys; 39, identifier:numkeys; 40, call; 41, identifier:args; 42, list; 43, assert_statement; 44, expression_statement; 45, for_statement; 46, expression_statement; 47, block; 48, identifier:aggregate; 49, attribute; 50, expression_statement; 51, comparison_operator:aggregate is self.ZSET_AGGREGATE_MAX; 52, block; 53, comparison_operator:aggregate is self.ZSET_AGGREGATE_MIN; 54, block; 55, identifier:fut; 56, call; 57, tuple; 58, identifier:keys; 59, identifier:len; 60, argument_list; 61, call; 62, parenthesized_expression; 63, assignment; 64, pattern_list; 65, identifier:keys; 66, block; 67, call; 68, expression_statement; 69, identifier:self; 70, identifier:ZSET_AGGREGATE_SUM; 71, call; 72, identifier:aggregate; 73, attribute; 74, expression_statement; 75, identifier:aggregate; 76, attribute; 77, expression_statement; 78, attribute; 79, argument_list; 80, identifier:key; 81, identifier:keys; 82, identifier:all; 83, generator_expression; 84, string:"All key arguments must be (key, weight) tuples"; 85, identifier:weights; 86, list; 87, identifier:key; 88, identifier:weight; 89, expression_statement; 90, expression_statement; 91, attribute; 92, argument_list; 93, call; 94, attribute; 95, argument_list; 96, identifier:self; 97, identifier:ZSET_AGGREGATE_MAX; 98, call; 99, identifier:self; 100, identifier:ZSET_AGGREGATE_MIN; 101, call; 102, identifier:self; 103, identifier:execute; 104, string; 105, identifier:destkey; 106, identifier:numkeys; 107, list_splat; 108, call; 109, for_in_clause; 110, string; 111, call; 112, call; 113, identifier:args; 114, identifier:extend; 115, identifier:weights; 116, attribute; 117, argument_list; 118, identifier:args; 119, identifier:extend; 120, tuple; 121, attribute; 122, argument_list; 123, attribute; 124, argument_list; 125, string_content:ZUNIONSTORE; 126, identifier:args; 127, identifier:isinstance; 128, argument_list; 129, identifier:val; 130, identifier:keys; 131, string_content:WEIGHTS; 132, attribute; 133, argument_list; 134, attribute; 135, argument_list; 136, identifier:args; 137, identifier:extend; 138, identifier:keys; 139, string; 140, string; 141, identifier:args; 142, identifier:extend; 143, tuple; 144, identifier:args; 145, identifier:extend; 146, tuple; 147, identifier:val; 148, tuple; 149, identifier:args; 150, identifier:append; 151, identifier:key; 152, identifier:weights; 153, identifier:append; 154, identifier:weight; 155, string_content:AGGREGATE; 156, string_content:SUM; 157, string; 158, string; 159, string; 160, string; 161, identifier:list; 162, identifier:tuple; 163, string_content:AGGREGATE; 164, string_content:MAX; 165, string_content:AGGREGATE; 166, string_content:MIN
code: def zunionstore(self, destkey, key, *keys,
                      with_weights=False, aggregate=None):
          """Add multiple sorted sets and store result in a new key."""
          keys = (key,) + keys
          numkeys = len(keys)
          args = []
          if with_weights:
              assert all(isinstance(val, (list, tuple)) for val in keys), (
                  "All key arguments must be (key, weight) tuples")
              weights = ['WEIGHTS']
              for key, weight in keys:
                  args.append(key)
                  weights.append(weight)
              args.extend(weights)
          else:
              args.extend(keys)
  
          if aggregate is self.ZSET_AGGREGATE_SUM:
              args.extend(('AGGREGATE', 'SUM'))
          elif aggregate is self.ZSET_AGGREGATE_MAX:
              args.extend(('AGGREGATE', 'MAX'))
          elif aggregate is self.ZSET_AGGREGATE_MIN:
              args.extend(('AGGREGATE', 'MIN'))
          fut = self.execute(b'ZUNIONSTORE', destkey, numkeys, *args)
          return fut