<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hset(self, hashkey, attribute, value):
 """Emulate hset."""


        redis_hash = self._get_hash(hashkey, 'HSET', create=True)
        attribute = self._encode(attribute)
        attribute_present = attribute in redis_hash
        redis_hash[attribute] = self._encode(value)
        return long(0) if attribute_present else long(1)