Base64url encoding
Your task
Implement base64url encoding as used in JWTs and URL-safe tokens. Given a UTF-8 string data, return its base64url-encoded form: standard base64 but using '-' and '_' instead of '+' and '/', with all trailing '=' padding removed. An empty input encodes to an empty string.
Examples
base64url_encode(data: str) -> strExample 1
Input
base64url_encode("hello")Output
"aGVsbG8"