def syntax_highlight(filename):
    """Return HTML with syntax-highlighted Python code from a file."""
    # TODO: use pygments instead
    try:
        pipe = subprocess.Popen(HIGHLIGHT_COMMAND + [filename],
                                stdout=subprocess.PIPE)
        text, stderr = pipe.communicate()
        if pipe.returncode != 0:
            raise OSError
    except __HOLE__:
        # Failed to run enscript; maybe it is not installed?  Disable
        # syntax highlighting then.
        with open(filename, 'r') as file:
            text = cgi.escape(file.read())
    else:
        #print(text)
        #text = text.decode('utf-8')
        text = text[text.find('<PRE>')+len('<PRE>'):]
        text = text[:text.find('</PRE>')]
    return text
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/test/coveragereport.py/syntax_highlight