<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def signature_for_message_hash(self, secret_exponent, msg_hash, is_compressed):
 """ Return a signature, encoded in Base64, of msg_hash. """

        r, s, recid = self._generator.sign_with_recid(secret_exponent, msg_hash)

        # See http://bitcoin.stackexchange.com/questions/14263 and key.cpp
        # for discussion of the proprietary format used for the signature

        first = 27 + recid + (4 if is_compressed else 0)
        sig = b2a_base64(int2byte(first) + to_bytes_32(r) + to_bytes_32(s)).strip()
        sig = sig.decode("utf8")
        return sig