def parse(self, data):
<EOL>graph = self._init_graph()<EOL>server = self._server_common_name<EOL>graph.add_node(server)<EOL>if data is None:<EOL><INDENT>clients = []<EOL>links = []<EOL><DEDENT>else:<EOL><INDENT>clients = data.client_list.values()<EOL>links = data.routing_table.values()<EOL><DEDENT>for client in clients:<EOL><INDENT>if client.common_name == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>client_properties = {<EOL>'<STR_LIT:label>': client.common_name,<EOL>'<STR_LIT>': str(client.real_address.host),<EOL>'<STR_LIT:port>': int(client.real_address.port),<EOL>'<STR_LIT>': client.connected_since.strftime('<STR_LIT>'),<EOL>'<STR_LIT>': int(client.bytes_received),<EOL>'<STR_LIT>': int(client.bytes_sent)<EOL>}<EOL>local_addresses = [<EOL>str(route.virtual_address)<EOL>for route in data.routing_table.values()<EOL>if route.real_address == client.real_address<EOL>]<EOL>if local_addresses:<EOL><INDENT>client_properties['<STR_LIT>'] = local_addresses<EOL><DEDENT>graph.add_node(str(client.real_address.host), **client_properties)<EOL><DEDENT>for link in links:<EOL><INDENT>if link.common_name == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>graph.add_edge(server, str(link.real_address.host), weight=<NUM_LIT:1>)<EOL><DEDENT>return graph<EOL>
Converts a OpenVPN JSON to a NetworkX Graph object
which is then returned.