'Convert to a new object of networkx.MultiGraph-like class cls
data: include node and edge data
keys: include edge keys as well as edge data'

def convertTo(self, cls, data=False, keys=False):

    g = cls()
    g.add_nodes_from(self.nodes(data=data))
    g.add_edges_from(self.edges(data=(data or keys), keys=keys))
    return g
