compile

        High-level api: Compile a module.

        Parameters
        ----------

        module : `str`
            Module name that is inquired about.

        Returns
        -------

        Model
            A Model object.

def compile(self, module):
        '''compile

        High-level api: Compile a module.

        Parameters
        ----------

        module : `str`
            Module name that is inquired about.

        Returns
        -------

        Model
            A Model object.
        '''

        imports, depends = self.get_dependencies(module)
        file_list = list(imports | depends) + [module]
        cmd_list = ['pyang', '-f', 'cxml', '--plugindir', self.pyang_plugins]
        cmd_list += ['-p', self.dir_yang]
        cmd_list += [self.dir_yang + '/' + f + '.yang' for f in file_list]
        logger.info('Compiling {}.yang: {}'.format(module,
                                                   ' '.join(cmd_list)))
        p = Popen(' '.join(cmd_list), shell=True, stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()
        logger.info('pyang return code is {}'.format(p.returncode))
        if p.returncode == 0:
            logger.debug(stderr.decode())
        else:
            logger.error(stderr.decode())
        parser = etree.XMLParser(remove_blank_text=True)
        tree = etree.XML(stdout.decode(), parser)
        return Model(tree)