def rewrite_elife_editors_json(json_content, doi):
<EOL>for i, ref in enumerate(json_content):<EOL><INDENT>if ref.get("<STR_LIT>"):<EOL><INDENT>for aff in ref.get("<STR_LIT>"):<EOL><INDENT>if "<STR_LIT:name>" not in aff:<EOL><INDENT>del(json_content[i]["<STR_LIT>"])<EOL><DEDENT><DEDENT><DEDENT><DEDENT>editor_roles = {}<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>editor_roles["<STR_LIT>"] = "<STR_LIT>"<EOL>if doi in editor_roles:<EOL><INDENT>for i, ref in enumerate(json_content):<EOL><INDENT>if not ref.get("<STR_LIT>"):<EOL><INDENT>json_content[i]["<STR_LIT>"] = editor_roles[doi]<EOL><DEDENT>elif ref.get("<STR_LIT>"):<EOL><INDENT>json_content[i]["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for i, ref in enumerate(json_content):<EOL><INDENT>if ref.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>json_content[i]["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>editors_kept = []<EOL>for i, ref in enumerate(json_content):<EOL><INDENT>editor_values = OrderedDict()<EOL>editor_values["<STR_LIT>"] = ref.get("<STR_LIT>")<EOL>if ref.get("<STR_LIT:name>"):<EOL><INDENT>editor_values["<STR_LIT:name>"] = ref.get("<STR_LIT:name>").get("<STR_LIT:index>")<EOL><DEDENT>if editor_values in editors_kept:<EOL><INDENT>del json_content[i]<EOL><DEDENT>else:<EOL><INDENT>editors_kept.append(editor_values)<EOL><DEDENT><DEDENT>role_replacements = [<EOL>{<EOL>"<STR_LIT>": ["<STR_LIT>", "<STR_LIT>"],<EOL>"<STR_LIT>": "<STR_LIT>"}<EOL>]<EOL>for replace_rule in role_replacements:<EOL><INDENT>same_name_map = person_same_name_map(json_content, replace_rule.get('<STR_LIT>'))<EOL>role_is_set = None<EOL>for same_id_list in same_name_map.values():<EOL><INDENT>if not same_id_list or len(same_id_list) <= <NUM_LIT:1>:<EOL><INDENT>continue<EOL><DEDENT>deleted_count = <NUM_LIT:0><EOL>for same_id in same_id_list:<EOL><INDENT>if not role_is_set:<EOL><INDENT>json_content[same_id]["<STR_LIT>"] = replace_rule.get("<STR_LIT>")<EOL>role_is_set = True<EOL><DEDENT>else:<EOL><INDENT>del json_content[same_id-deleted_count]<EOL>deleted_count += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT><DEDENT>return json_content<EOL>
this does the work of rewriting elife editors json