def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False):
        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)