code: def render_and_write(template_dir, path, context):
      
      env = Environment(loader=FileSystemLoader(template_dir))
      template_file = os.path.basename(path)
      template = env.get_template(template_file)
      log('Rendering from template: %s' % template.name, level=DEBUG)
      rendered_content = template.render(context)
      if not rendered_content:
          log("Render returned None - skipping '%s'" % path,
              level=WARNING)
          return
  
      write(path, rendered_content.encode('utf-8').strip())
      log('Wrote template %s' % path, level=DEBUG)
docs: Renders the specified template into the file.
  
      :param template_dir: the directory to load the template from
      :param path: the path to write the templated contents to
      :param context: the parameters to pass to the rendering engine