code: def hsetnx(self, hashkey, attribute, value):
          
  
          redis_hash = self._get_hash(hashkey, 'HSETNX', create=True)
          attribute = self._encode(attribute)
          if attribute in redis_hash:
              return long(0)
          else:
              redis_hash[attribute] = self._encode(value)
              return long(1)
docs: Emulate hsetnx.