code: def signature_for_message_hash(self, secret_exponent, msg_hash, is_compressed):
          
          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
docs: Return a signature, encoded in Base64, of msg_hash.