Takes the a message and a parsed recoverable signature
        Returns the serialized public key from the private key in the sign function

def ecdsa_recover_compact(msg32, sig):
    """
        Takes the a message and a parsed recoverable signature
        Returns the serialized public key from the private key in the sign function
    """
    assert isinstance(msg32, bytes)
    assert len(msg32) == 32
    _check_signature(sig)
    # Check that recid is of valid value
    recid = ord(sig[64:65])

    if not (recid >= 0 and recid <= 3):
        raise InvalidSignatureError()

    # Setting the pubkey array
    pubkey = ffi.new("secp256k1_pubkey *")

    lib.secp256k1_ecdsa_recover(
        ctx,
        pubkey,
        _parse_to_recoverable_signature(sig),
        msg32
    )

    serialized_pubkey = _serialize_pubkey(pubkey)

    buf = ffi.buffer(serialized_pubkey, 65)
    r = buf[:]
    assert isinstance(r, bytes)
    assert len(r) == 65, len(r)
    return r