def METHOD_NAME(path, cp):
    """ Render a file as text.
    """
    # define filename and slug from path
    filename = os.path.basename(path)
    slug = filename.replace('.', '_')
    # initializations
    content = None
    # read file as a string
    with codecs.open(path, 'r', encoding='utf-8', errors='replace') as fp:
        content = fp.read()
    # replace all the escaped characters
    content = unescape(content, unescape_table)
    # render template
    template_dir = pycbc.results.__path__[0] + '/templates/files'
    env = Environment(loader=FileSystemLoader(template_dir))
    env.globals.update(abs=abs)
    env.globals.update(path_exists=os.path.exists)
    template = env.get_template('file_pre.html')
    context = {'filename' : filename,
               'slug'     : slug,
               'cp'       : cp,
               'content'  : content}
    output = template.render(context)
    return output