<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next(self, data, final = False, to_buffer = False):
 """ Add more input to the HMAC SHA1. """

        if final:
            self.flags = pyhsm.defines.YSM_HMAC_SHA1_FINAL
        else:
            self.flags = 0x0
        if to_buffer:
            self.flags |= pyhsm.defines.YSM_HMAC_SHA1_TO_BUFFER
        self.payload = _raw_pack(self.key_handle, self.flags, data)
        self.final = final
        return self