def blinded_abs(blinded_id: str):
    """
    Takes a blinded hex pubkey (i.e. length 66, prefixed with 15) and returns the positive pubkey
    alternative: that is, if the pubkey is already positive, it is returned as-is; otherwise the
    returned value is a copy with the sign bit cleared.
    """

    # Sign bit is the MSB of the last byte, which will be at [31] of the private key, hence 64 is
    # the most significant nibble once we convert to hex and add 2 for the prefix:
    msn = int(blinded_id[64], 16)
    if msn & 0x8:
        return blinded_id[0:64] + str(msn & 0x7) + blinded_id[65:]
    return blinded_id