def flight_log_multiaxis_graph_contents_replacer(contents):
    """Values list is from the function flight_data_and_axis."""
    comma = None
    lines = contents.split('\n')
    line_list = []
    for index in range(len(lines)):
        if '"MULTIAXIS_GRAPH\\n"' in lines[index]:
            line_list.append(index)
    graph_data = []
    for index in line_list:
        a = 0
        b = 1
        local_graph_data = [index]
        while a == 0:
            if lines[index + b] == '   ]':
                graph_data.append(local_graph_data)
                break
            if lines[index + b] != '    "\\n",':
                local_graph_data.append(index + b)
            b += 1
    graph_list = []
    graph_data_index = 0
    for data in graph_data:
        graph_list.append([[], []])
        axis = 0
        for index in data[1:]:
            ignore = False
            line = lines[index]
            line = line.replace('    "', '')
            line = line.replace('"', '')
            line = line.replace('\\n,', '')
            if line == 'LEFT_AXIS':
                axis = 0
                ignore = True
            if line == 'RIGHT_AXIS':
                axis = 1
                ignore = True
            line = line.lower()
            line = line.replace(' ', '\\", \\"')
            line = line.replace('_', ' ')
            if ignore is False:
                graph_list[graph_data_index][axis].append('[\\"' + line +
                    '\\"]')
        graph_data_index += 1
    notebook_lines = []
    for data in graph_list:
        line = ('  {\n   "cell_type": "code",\n' +
            """   "execution_count": null,
   "metadata": {},
""" +
            """   "outputs": [],
   "source": [
""" +
            '   "x_limits=[\\"x_min\\", \\"x_max\\"]\\n",\n' +
            """   "y_limits_left=[\\"y_min\\", \\"y_max\\"]\\n",
""" +
            '   "y_limits_right=[\\"y_min\\", \\"y_max\\"]\\n",\n' +
            '   "legend_location=1\\n",\n' + '   "multiaxis_graph_plotter([')
        for axis_left in data[0]:
            line += axis_left + ', '
        line = line[:-2]
        line += '], ['
        for axis_right in data[1]:
            line += axis_right + ', '
        line = line[:-2]
        line += '], values_list, x_limits, y_limits_left, y_limits_right,' + """ marker_list, legend_location)"
   ]
  }"""
        notebook_lines.append(line)
    index = 0
    for element in line_list:
        old_cell_text = ''
        for lines_before in reversed(lines[:element]):
            a = 0
            old_cell_text = lines_before + '\n' + old_cell_text
            if lines_before == '  {':
                a = 1
                for lines_after in lines[element:]:
                    if '  },' in lines_after:
                        old_cell_text = old_cell_text + '  },\n'
                        comma = True
                        break
                    elif '  }' in lines_after:
                        old_cell_text = old_cell_text + '  }\n'
                        comma = False
                        break
                    else:
                        old_cell_text = old_cell_text + lines_after + '\n'
            if a == 1:
                break
        if comma is True:
            end = ',\n'
        else:
            end = '\n'
        contents = contents.replace(old_cell_text, notebook_lines[index] + end)
        index += 1
    return contents
