'Render this module template to ``dest`` with the provided
rendering parameters'

def render_to(self, modname, directory, params=None):

    for (path, content) in self.files():
        local = os.path.relpath(path, self.path)
        (root, ext) = os.path.splitext(local)
        if (ext == '.template'):
            local = root
        dest = os.path.join(directory, modname, local)
        destdir = os.path.dirname(dest)
        if (not os.path.exists(destdir)):
            os.makedirs(destdir)
        with open(dest, 'wb') as f:
            if (ext not in ('.py', '.xml', '.csv', '.js', '.rst', '.html', '.template')):
                f.write(content)
            else:
                env.from_string(content.decode('utf-8')).stream((params or {})).dump(f, encoding='utf-8')
