Encode a string to bytes.
Usage
encode( data, encoding="utf-8", )
data: str
The string to encode.
encoding: str = "utf-8"
The target encoding.
bytes
The encoded bytes.