def encode(raw: Any) -> str:
if raw is None:<EOL><INDENT>return str(I32_BOUND)  <EOL><DEDENT>stringified = str(raw)<EOL>if isinstance(raw, bool):<EOL><INDENT>return '<STR_LIT>'.format(<EOL>ENCODE_PREFIX[bool],<EOL>I32_BOUND + <NUM_LIT:2> if raw else I32_BOUND + <NUM_LIT:1>)  <EOL><DEDENT>if isinstance(raw, int) and -I32_BOUND <= raw < I32_BOUND:<EOL><INDENT>return stringified  <EOL><DEDENT>hexed = '<STR_LIT>'.format(<EOL>ENCODE_PREFIX.get(type(raw), ENCODE_PREFIX[None]),<EOL>str(int.from_bytes(hexlify(stringified.encode()), '<STR_LIT>') + I32_BOUND))<EOL>return hexed<EOL>
Encode credential attribute value, leaving any (stringified) int32 alone: indy-sdk predicates
operate on int32 values properly only when their encoded values match their raw values.

To disambiguate for decoding, the operation reserves a sentinel for the null value and otherwise adds
2**31 to any non-trivial transform of a non-int32 input, then prepends a digit marking the input type:
* 1: string
* 2: boolean
* 3: non-32-bit integer
* 4: floating point
* 9: other (stringifiable)

:param raw: raw value to encode
:return: encoded value