def url_to_filename(url: str, etag: str = None) -> str:
url_bytes = url.encode('<STR_LIT:utf-8>')<EOL>b64_bytes = base64.b64encode(url_bytes)<EOL>decoded = b64_bytes.decode('<STR_LIT:utf-8>')<EOL>if etag:<EOL><INDENT>etag = etag.replace('<STR_LIT:">', '<STR_LIT>')<EOL>return f"<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>return decoded<EOL><DEDENT>
Converts a url into a filename in a reversible way.
If `etag` is specified, add it on the end, separated by a period
(which necessarily won't appear in the base64-encoded filename).
Get rid of the quotes in the etag, since Windows doesn't like them.