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.

def get_path(self, instance=True, origin='openconfig'):
        '''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.
        '''

        def get_name(node, default_ns):
            if origin == 'openconfig' or origin == '':
                return gNMIParser.parse_tag(node.tag)
            else:
                return self.device.convert_tag(default_ns,
                                               node.tag,
                                               src=Tag.LXML_ETREE,
                                               dst=ns_spec[origin]['path'])

        def get_keys(node, default_ns):
            keys = Composer(self.device, node).keys
            ret = {}
            for key in keys:
                if origin=='openconfig' or origin == '':
                    key_ns, key_val = gNMIParser.parse_tag(key)
                else:
                    key_ns, key_val = self.device.convert_tag(default_ns,
                                                              key,
                                                              src=Tag.LXML_ETREE,
                                                              dst=ns_spec[origin]['path'])
                ns_tuple = self.convert_ns(key_ns, src=Tag.NAMESPACE)
                val_ns, val_val = self.device.convert_tag(ns_tuple[Tag.PREFIX],
                                                          node.find(key).text,
                                                          src=Tag.XPATH,
                                                          dst=ns_spec[origin]['path'])
                ret[key_val] = val_val
            return ret

        def get_pathelem(node, default_ns):
            ns, name = get_name(node, default_ns)
            schema_node = self.device.get_schema_node(node)
            if schema_node.get('type') == 'list' and \
               (node != self.node or instance):
                return ns, PathElem(name=name, key=get_keys(node, ns))
            else:
                return ns, PathElem(name=name)

        nodes = list(reversed(list(self.node.iterancestors())))[1:] + \
                [self.node]
        path_elems = []
        default_ns = ''
        for node in nodes:
            default_ns, path_elem = get_pathelem(node, default_ns)
            path_elems.append(path_elem)
        return Path(elem=path_elems, origin=origin)