<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_alfred_vis(self, data):
 """ Converts a alfred-vis JSON object to a NetworkX Graph object which is then returned. Additionally checks for "source_vesion" to determine the batman-adv version. """

        # initialize graph and list of aggregated nodes
        graph = self._init_graph()
        if 'source_version' in data:
            self.version = data['source_version']
        if 'vis' not in data:
            raise ParserError('Parse error, "vis" key not found')
        node_list = self._get_aggregated_node_list(data['vis'])

        # loop over topology section and create networkx graph
        for node in data["vis"]:
            for neigh in node["neighbors"]:
                graph.add_node(node['primary'], **{
                    'local_addresses': node.get('secondary', []),
                    'clients': node.get('clients', [])
                })
                primary_neigh = self._get_primary_address(neigh['neighbor'],
                                                          node_list)
                # networkx automatically ignores duplicated edges
                graph.add_edge(node['primary'],
                               primary_neigh,
                               weight=float(neigh['metric']))
        return graph