<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def digest(self,data=None):
 """ Method digest is redefined to return keyed MAC value instead of just digest. """

        if data is not None:
            self.update(data)
        b=create_string_buffer(256)
        size=c_size_t(256)
        if libcrypto.EVP_DigestSignFinal(self.ctx,b,pointer(size))<=0:
            raise DigestError('SignFinal')
        self.digest_finalized=True
        return b.raw[:size.value]