def punctuate_authorname(an):
name = an.strip()<EOL>parts = [x for x in name.split('<STR_LIT:U+002C>') if x != '<STR_LIT>']<EOL>ret_str = '<STR_LIT>'<EOL>for idx, part in enumerate(parts):<EOL><INDENT>subparts = part.strip().split('<STR_LIT:U+0020>')<EOL>for sidx, substr in enumerate(subparts):<EOL><INDENT>ret_str += substr<EOL>if len(substr) == <NUM_LIT:1>:<EOL><INDENT>ret_str += '<STR_LIT:.>'<EOL><DEDENT>if sidx < (len(subparts) - <NUM_LIT:1>):<EOL><INDENT>ret_str += '<STR_LIT:U+0020>'<EOL><DEDENT><DEDENT>if idx < (len(parts) - <NUM_LIT:1>):<EOL><INDENT>ret_str += '<STR_LIT:U+002CU+0020>'<EOL><DEDENT><DEDENT>return ret_str.strip()<EOL>
Punctuate author names properly.

    Expects input in the form 'Bloggs, J K' and will return 'Bloggs, J. K.'.