def get_path(self, instance=True, origin='<STR_LIT>'):
def get_name(node, default_ns):<EOL><INDENT>if origin == '<STR_LIT>' or origin == '<STR_LIT>':<EOL><INDENT>return gNMIParser.parse_tag(node.tag)<EOL><DEDENT>else:<EOL><INDENT>return self.device.convert_tag(default_ns,<EOL>node.tag,<EOL>src=Tag.LXML_ETREE,<EOL>dst=ns_spec[origin]['<STR_LIT:path>'])<EOL><DEDENT><DEDENT>def get_keys(node, default_ns):<EOL><INDENT>keys = Composer(self.device, node).keys<EOL>ret = {}<EOL>for key in keys:<EOL><INDENT>if origin=='<STR_LIT>' or origin == '<STR_LIT>':<EOL><INDENT>key_ns, key_val = gNMIParser.parse_tag(key)<EOL><DEDENT>else:<EOL><INDENT>key_ns, key_val = self.device.convert_tag(default_ns,<EOL>key,<EOL>src=Tag.LXML_ETREE,<EOL>dst=ns_spec[origin]['<STR_LIT:path>'])<EOL><DEDENT>ns_tuple = self.convert_ns(key_ns, src=Tag.NAMESPACE)<EOL>val_ns, val_val = self.device.convert_tag(ns_tuple[Tag.PREFIX],<EOL>node.find(key).text,<EOL>src=Tag.XPATH,<EOL>dst=ns_spec[origin]['<STR_LIT:path>'])<EOL>ret[key_val] = val_val<EOL><DEDENT>return ret<EOL><DEDENT>def get_pathelem(node, default_ns):<EOL><INDENT>ns, name = get_name(node, default_ns)<EOL>schema_node = self.device.get_schema_node(node)<EOL>if schema_node.get('<STR_LIT:type>') == '<STR_LIT:list>' and(node != self.node or instance):<EOL><INDENT>return ns, PathElem(name=name, key=get_keys(node, ns))<EOL><DEDENT>else:<EOL><INDENT>return ns, PathElem(name=name)<EOL><DEDENT><DEDENT>nodes = list(reversed(list(self.node.iterancestors())))[<NUM_LIT:1>:] +[self.node]<EOL>path_elems = []<EOL>default_ns = '<STR_LIT>'<EOL>for node in nodes:<EOL><INDENT>default_ns, path_elem = get_pathelem(node, default_ns)<EOL>path_elems.append(path_elem)<EOL><DEDENT>return Path(elem=path_elems, origin=origin)<EOL>
get_path

        High-level api: get_path returns gNMI path object of the config node.
        Note that gNMI Path can specify list instance but cannot specify
        leaf-list instance.

        Parameters
        ----------

        instance : `bool`
            True if the gNMI Path object refers to only one instance of a list.
            False if the gNMI Path object refers to all instances of a list.

        Returns
        -------

        Path
            An object of gNMI Path class.