def avro_name(url):  
frg = urllib.parse.urldefrag(url)[<NUM_LIT:1>]<EOL>if frg != '<STR_LIT>':<EOL><INDENT>if '<STR_LIT:/>' in frg:<EOL><INDENT>return frg[frg.rindex('<STR_LIT:/>') + <NUM_LIT:1>:]<EOL><DEDENT>return frg<EOL><DEDENT>return url<EOL>
Turn a URL into an Avro-safe name.

If the URL has no fragment, return this plain URL.

Extract either the last part of the URL fragment past the slash, otherwise
the whole fragment.