def rewrite_elife_body_json(json_content, doi):
<EOL>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>if (json_content[<NUM_LIT:0>].get("<STR_LIT:type>") and json_content[<NUM_LIT:0>].get("<STR_LIT:type>") == "<STR_LIT>"<EOL>and json_content[<NUM_LIT:0>].get("<STR_LIT:title>") and json_content[<NUM_LIT:0>].get("<STR_LIT:title>") =="<STR_LIT>"<EOL>and not json_content[<NUM_LIT:0>].get("<STR_LIT:id>")):<EOL><INDENT>json_content[<NUM_LIT:0>]["<STR_LIT:id>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>for outer_block in json_content:<EOL><INDENT>if outer_block.get("<STR_LIT:id>") and outer_block.get("<STR_LIT:id>") == "<STR_LIT>":<EOL><INDENT>for mid_block in outer_block.get("<STR_LIT:content>"):<EOL><INDENT>if mid_block.get("<STR_LIT:id>") and mid_block.get("<STR_LIT:id>") == "<STR_LIT>":<EOL><INDENT>for inner_block in mid_block.get("<STR_LIT:content>"):<EOL><INDENT>if inner_block.get("<STR_LIT:content>") and not inner_block.get("<STR_LIT:title>"):<EOL><INDENT>mid_block["<STR_LIT:content>"] = inner_block.get("<STR_LIT:content>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>for i, outer_block in enumerate(json_content):<EOL><INDENT>if (outer_block.get("<STR_LIT:id>") and outer_block.get("<STR_LIT:id>") in ["<STR_LIT>", "<STR_LIT>"]<EOL>and not outer_block.get("<STR_LIT:title>")):<EOL><INDENT>if outer_block.get("<STR_LIT:content>"):<EOL><INDENT>json_content[i] = outer_block.get("<STR_LIT:content>")[<NUM_LIT:0>]<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>for outer_block in json_content:<EOL><INDENT>if outer_block.get("<STR_LIT:id>") and outer_block.get("<STR_LIT:id>") == "<STR_LIT>":<EOL><INDENT>for mid_block in outer_block.get("<STR_LIT:content>"):<EOL><INDENT>if mid_block.get("<STR_LIT:content>") and not mid_block.get("<STR_LIT:id>"):<EOL><INDENT>new_blocks = []<EOL>for inner_block in mid_block.get("<STR_LIT:content>"):<EOL><INDENT>new_blocks.append(inner_block)<EOL><DEDENT>outer_block["<STR_LIT:content>"] = new_blocks<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>if (json_content[<NUM_LIT:0>].get("<STR_LIT:type>") and json_content[<NUM_LIT:0>].get("<STR_LIT:type>") == "<STR_LIT>"<EOL>and json_content[<NUM_LIT:0>].get("<STR_LIT:id>") and json_content[<NUM_LIT:0>].get("<STR_LIT:id>") == "<STR_LIT>"):<EOL><INDENT>json_content[<NUM_LIT:0>]["<STR_LIT:title>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0>):<EOL><INDENT>i_index = j_index = None<EOL>for i, outer_block in enumerate(json_content):<EOL><INDENT>if (outer_block.get("<STR_LIT:id>") and outer_block.get("<STR_LIT:id>") == "<STR_LIT>"<EOL>and outer_block.get("<STR_LIT:content>")):<EOL><INDENT>i_index = i<EOL>break<EOL><DEDENT><DEDENT>if i_index is not None:<EOL><INDENT>for j, inner_block in enumerate(json_content[i_index].get("<STR_LIT:content>")):<EOL><INDENT>if (inner_block.get("<STR_LIT:id>") and inner_block.get("<STR_LIT:id>") == "<STR_LIT>"<EOL>and inner_block.get("<STR_LIT:content>") is None):<EOL><INDENT>j_index = j<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if i_index is not None and j_index is not None:<EOL><INDENT>del json_content[i_index]["<STR_LIT:content>"][j_index]<EOL><DEDENT><DEDENT><DEDENT>if doi == "<STR_LIT>":<EOL><INDENT>if (json_content and len(json_content) > <NUM_LIT:0> and json_content[<NUM_LIT:0>].get("<STR_LIT:type>")<EOL>and json_content[<NUM_LIT:0>]["<STR_LIT:type>"] == "<STR_LIT>"):<EOL><INDENT>new_body = OrderedDict()<EOL>for i, tag_block in enumerate(json_content):<EOL><INDENT>if i == <NUM_LIT:0>:<EOL><INDENT>tag_block["<STR_LIT:title>"] = "<STR_LIT>"<EOL>new_body = tag_block<EOL><DEDENT>elif i > <NUM_LIT:0>:<EOL><INDENT>new_body["<STR_LIT:content>"].append(tag_block)<EOL><DEDENT><DEDENT>json_content = [new_body]<EOL><DEDENT><DEDENT>return json_content<EOL>
rewrite elife body json