<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Analyse Network
This is a template notebook to read, study, modify and save a given network, usually the results of an evolutionnary simulation.
These networks may be manually retrieved manually from a simulation by looking into the folder my_simulation/Seed#n/Bests_#gen.net. Where #n is the seed number and #gen the generation of the network. It is a better practice to save networks with a .net extension.
To run the integrator on a network, you have to define a model, this is done by giving the path of the model at the beginning of the Definition and proxy cell.
Please Kernel&gt;Restart &amp; Run All for every new project to make sure you start with a clean notebook.
Import required libraries
Step1:  Definition and proxy for usefull functions
Step2:  Analyse
<ASSISTANT_TASK:>
Python Code:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
from  ipywidgets import widgets 
from ipywidgets import interact, interactive, fixed
from IPython.display import display,HTML,clear_output
import os
HTML('''<script>code_show=true;function code_toggle() {if (code_show){$('div.input').hide();} else {$('div.input').show();} code_show = !code_show} $( document ).ready(code_toggle);</script><form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
import phievo.AnalysisTools as AT
from  phievo.AnalysisTools.Notebook import Notebook
notebook = Notebook()
Explanation: Analyse Network
This is a template notebook to read, study, modify and save a given network, usually the results of an evolutionnary simulation.
These networks may be manually retrieved manually from a simulation by looking into the folder my_simulation/Seed#n/Bests_#gen.net. Where #n is the seed number and #gen the generation of the network. It is a better practice to save networks with a .net extension.
To run the integrator on a network, you have to define a model, this is done by giving the path of the model at the beginning of the Definition and proxy cell.
Please Kernel&gt;Restart &amp; Run All for every new project to make sure you start with a clean notebook.
Import required libraries
End of explanation
MODEL = "adaptation"
sim = AT.Simulation(MODEL)
read_network = AT.main_functions.read_network
def write_network(net,filename): net.store_to_pickle(filename)
def draw(net,label=False): net.draw(edgeLegend=label)
def fitness(net,trial): return sim.run_dynamics(net,trial,erase_buffer=False,return_treatment_fitness=True)
def gene_knock_out(net,label): net.delete_clean(label,target='species')
    
def remove_interaction(net,label): net.delete_clean(label,target='interaction')
Explanation: Definition and proxy for usefull functions
End of explanation
net = read_network("test.pkl")
draw(net)
gene_knock_out(net,1)
draw(net)
Explanation: Analyse
End of explanation
<END_TASK>