[docs]defnetwork_from_porespy(filename):r""" Load a network extracted using the PoreSpy package Parameters ---------- filename : str or dict Can either be a filename pointing to a pickled dictionary, or a handle to a dictionary in memory. The second option lets users avoid the step of saving the dictionary to a file. Returns ------- network : dict An OpenPNM network dictionary """# Parse the filenameifisinstance(filename,dict):net=filenameelse:filename=_parse_filename(filename=filename)withopen(filename,mode='rb')asf:net=pk.load(f)network=Network()network.update(net)returnnetwork