Unserialize a JSON string representation of a topology

def unserialize(jsonstr):
        '''
        Unserialize a JSON string representation of a topology
        '''
        topod = json.loads(jsonstr)
        G = json_graph.node_link_graph(topod)
        for n,ndict in G.nodes(data=True):
            if 'nodeobj' not in ndict or 'type' not in ndict:
                raise Exception("Required type information is not present in serialized node {} :{}".format(n, ndict))
            nobj = ndict['nodeobj']
            cls = eval(ndict['type'])
            ndict['nodeobj'] = cls(**dict(nobj))
        t = Topology(nxgraph=G)
        return t