def get_custom_renderer(self, dir_path, layout=True):
        """
        Create a template renderer on templates in the directory specified, and returns it.
        :param dir_path: the path to the template dir. If it is not absolute, it will be taken from the root of the inginious package.
        :param layout: can either be True (use the base layout of the running app), False (use no layout at all), or the path to the layout to use.
                       If this path is relative, it is taken from the INGInious package root.
        """

        # if dir_path/base is a absolute path, os.path.join(something, an_absolute_path) returns an_absolute_path.
        root_path = inginious.get_root_path()

        if isinstance(layout, str):
            layout_path = os.path.join(root_path, layout)
        elif layout is True:
            layout_path = os.path.join(root_path, self._layout)
        else:
            layout_path = None

        return web.template.render(os.path.join(root_path, dir_path),
                                   globals=self._template_globals,
                                   base=layout_path)