def get_network_instances(self, name="<STR_LIT>"):
<EOL>command = "<STR_LIT>"<EOL>vrf_table_raw = self._get_command_table(command, "<STR_LIT>", "<STR_LIT>")<EOL>command = "<STR_LIT>"<EOL>intf_table_raw = self._get_command_table(command, "<STR_LIT>", "<STR_LIT>")<EOL>vrf_intfs = defaultdict(list)<EOL>for intf in intf_table_raw:<EOL><INDENT>vrf_intfs[intf["<STR_LIT>"]].append(py23_compat.text_type(intf["<STR_LIT>"]))<EOL><DEDENT>vrfs = {}<EOL>for vrf in vrf_table_raw:<EOL><INDENT>vrf_name = py23_compat.text_type(vrf.get("<STR_LIT>"))<EOL>vrfs[vrf_name] = {}<EOL>vrfs[vrf_name]["<STR_LIT:name>"] = vrf_name<EOL>if vrf_name == "<STR_LIT:default>":<EOL><INDENT>vrfs[vrf_name]["<STR_LIT:type>"] = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>vrfs[vrf_name]["<STR_LIT:type>"] = "<STR_LIT>"<EOL><DEDENT>vrfs[vrf_name]["<STR_LIT:state>"] = {<EOL>"<STR_LIT>": py23_compat.text_type(vrf.get("<STR_LIT>"))<EOL>}<EOL>vrfs[vrf_name]["<STR_LIT>"] = {}<EOL>vrfs[vrf_name]["<STR_LIT>"]["<STR_LIT>"] = dict.fromkeys(<EOL>vrf_intfs[vrf_name], {}<EOL>)<EOL><DEDENT>if name:<EOL><INDENT>if name in vrfs.keys():<EOL><INDENT>return {py23_compat.text_type(name): vrfs[name]}<EOL><DEDENT>else:<EOL><INDENT>return {}<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return vrfs<EOL><DEDENT>
get_network_instances implementation for NX-OS