nodes: 0, module; 1, function_definition; 2, function_name:zadd; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:mapping; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, expression_statement; 17, expression_statement; 18, if_statement; 19, if_statement; 20, if_statement; 21, if_statement; 22, for_statement; 23, return_statement; 24, identifier:nx; 25, False; 26, identifier:xx; 27, False; 28, identifier:ch; 29, False; 30, identifier:incr; 31, False; 32, comment:"""
          Set any number of element-name, score pairs to the key ``name``. Pairs
          are specified as a dict of element-names keys to score values.
  
          ``nx`` forces ZADD to only create new elements and not to update
          scores for elements that already exist.
  
          ``xx`` forces ZADD to only update scores of elements that already
          exist. New elements will not be added.
  
          ``ch`` modifies the return value to be the numbers of elements changed.
          Changed elements include new elements that were added and elements
          whose scores changed.
  
          ``incr`` modifies ZADD to behave like ZINCRBY. In this mode only a
          single element/score pair can be specified and the score is the amount
          the existing score will be incremented by. When using this mode the
          return value of ZADD will be the new score of the element.
  
          The return value of ZADD varies based on the mode specified. With no
          options, ZADD returns the number of new elements added to the sorted
          set.
          """; 33, not_operator; 34, block; 35, boolean_operator; 36, block; 37, boolean_operator; 38, block; 39, assignment; 40, assignment; 41, identifier:nx; 42, block; 43, identifier:xx; 44, block; 45, identifier:ch; 46, block; 47, identifier:incr; 48, block; 49, identifier:pair; 50, call; 51, block; 52, call; 53, identifier:mapping; 54, raise_statement; 55, identifier:nx; 56, identifier:xx; 57, raise_statement; 58, identifier:incr; 59, comparison_operator:len(mapping) != 1; 60, raise_statement; 61, identifier:pieces; 62, list; 63, identifier:options; 64, dictionary; 65, expression_statement; 66, expression_statement; 67, expression_statement; 68, expression_statement; 69, expression_statement; 70, identifier:iteritems; 71, argument_list; 72, expression_statement; 73, expression_statement; 74, attribute; 75, argument_list; 76, call; 77, call; 78, call; 79, integer:1; 80, call; 81, call; 82, call; 83, call; 84, call; 85, assignment; 86, identifier:mapping; 87, call; 88, call; 89, identifier:self; 90, identifier:execute_command; 91, string; 92, identifier:name; 93, list_splat; 94, dictionary_splat; 95, identifier:DataError; 96, argument_list; 97, identifier:DataError; 98, argument_list; 99, identifier:len; 100, argument_list; 101, identifier:DataError; 102, argument_list; 103, attribute; 104, argument_list; 105, attribute; 106, argument_list; 107, attribute; 108, argument_list; 109, attribute; 110, argument_list; 111, subscript; 112, True; 113, attribute; 114, argument_list; 115, attribute; 116, argument_list; 117, string_content:ZADD; 118, identifier:pieces; 119, identifier:options; 120, string:"ZADD requires at least one element/score pair"; 121, string:"ZADD allows either 'nx' or 'xx', not both"; 122, identifier:mapping; 123, concatenated_string; 124, identifier:pieces; 125, identifier:append; 126, call; 127, identifier:pieces; 128, identifier:append; 129, call; 130, identifier:pieces; 131, identifier:append; 132, call; 133, identifier:pieces; 134, identifier:append; 135, call; 136, identifier:options; 137, string; 138, identifier:pieces; 139, identifier:append; 140, subscript; 141, identifier:pieces; 142, identifier:append; 143, subscript; 144, string:"ZADD option 'incr' only works when passing a "; 145, string:"single element/score pair"; 146, attribute; 147, argument_list; 148, attribute; 149, argument_list; 150, attribute; 151, argument_list; 152, attribute; 153, argument_list; 154, string_content:as_score; 155, identifier:pair; 156, integer:1; 157, identifier:pair; 158, integer:0; 159, identifier:Token; 160, identifier:get_token; 161, string; 162, identifier:Token; 163, identifier:get_token; 164, string; 165, identifier:Token; 166, identifier:get_token; 167, string; 168, identifier:Token; 169, identifier:get_token; 170, string; 171, string_content:NX; 172, string_content:XX; 173, string_content:CH; 174, string_content:INCR
code: def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False):
          """
          Set any number of element-name, score pairs to the key ``name``. Pairs
          are specified as a dict of element-names keys to score values.
  
          ``nx`` forces ZADD to only create new elements and not to update
          scores for elements that already exist.
  
          ``xx`` forces ZADD to only update scores of elements that already
          exist. New elements will not be added.
  
          ``ch`` modifies the return value to be the numbers of elements changed.
          Changed elements include new elements that were added and elements
          whose scores changed.
  
          ``incr`` modifies ZADD to behave like ZINCRBY. In this mode only a
          single element/score pair can be specified and the score is the amount
          the existing score will be incremented by. When using this mode the
          return value of ZADD will be the new score of the element.
  
          The return value of ZADD varies based on the mode specified. With no
          options, ZADD returns the number of new elements added to the sorted
          set.
          """
          if not mapping:
              raise DataError("ZADD requires at least one element/score pair")
          if nx and xx:
              raise DataError("ZADD allows either 'nx' or 'xx', not both")
          if incr and len(mapping) != 1:
              raise DataError("ZADD option 'incr' only works when passing a "
                              "single element/score pair")
          pieces = []
          options = {}
          if nx:
              pieces.append(Token.get_token('NX'))
          if xx:
              pieces.append(Token.get_token('XX'))
          if ch:
              pieces.append(Token.get_token('CH'))
          if incr:
              pieces.append(Token.get_token('INCR'))
              options['as_score'] = True
          for pair in iteritems(mapping):
              pieces.append(pair[1])
              pieces.append(pair[0])
          return self.execute_command('ZADD', name, *pieces, **options)