def find_template_file(self, template_name):
        """Find template file and return it's filename.
           When template file is not found, IOError is raised.
        """
        filename = self.to_filename(template_name)
        if self.path:
            for dirname in self.path:
                filepath = dirname + os.path.sep + filename
                if os.path.isfile(filepath):
                    return filepath
        else:
            if os.path.isfile(filename):
                return filename
        raise IOError('%s: filename not found (path=%s).' % (filename, repr(self.path)))
dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/tenjin.py/Engine.find_template_file/original