Implement a Python function base64 encode(string: str bytes) - bytes that encodes its input using the…
Implement a Python function base64 encode(string: str bytes) - bytes that encodes its input using the…: a task in repo2rlenv-r2e (Harbor dataset). Behavior requirements: - Accept either a str or bytes argument. If a str is given, convert it to bytes (UTF-8 encoding) before encoding. - Produce…
The task
Behavior requirements: - Accept either a `str` or `bytes` argument. If a `str` is given, convert it to bytes (UTF-8 encoding) before encoding. - Produce output that uses `-` and `_` instead of the standard `+` and `/` characters (URL-safe Base64 alphabet). - Strip all trailing `=` padding characters from the output.…
Part of FineEnvs/repo2rlenv-r2e.