code: def render_glitchgram(path, cp):
      
  
      # define filename and slug from path
      filename = os.path.basename(path)
      slug = filename.replace('.', '_')
  
      # render template
      template_dir = pycbc.results.__path__[0] + '/templates/files'
      env = Environment(loader=FileSystemLoader(template_dir))
      env.globals.update(abs=abs)
      template = env.get_template(cp.get(filename, 'template'))
      context = {'filename' : filename,
                 'slug'     : slug,
                 'cp'       : cp}
      output = template.render(context)
  
      return output
docs: Render a glitchgram file template.