diff --git a/loopy/target/execution.py b/loopy/target/execution.py
index ffa0aa2ab3fc3e2d5a19d060589f803b02eb362e..d89eb8ba86375d94ad3f02f882927fcab1bc14f8 100644
--- a/loopy/target/execution.py
+++ b/loopy/target/execution.py
@@ -774,28 +774,22 @@ class KernelExecutorBase(object):
 # {{{ code highlighers
 
 
-def get_highlighted_python_code(text):
+def get_highlighted_code(text, python=False):
     try:
         from pygments import highlight
     except ImportError:
         return text
     else:
-        from pygments.lexers import PythonLexer
+        from pygments.lexers import CLexer, PythonLexer
         from pygments.formatters import TerminalFormatter
 
-        return highlight(text, PythonLexer(), TerminalFormatter())
+        return highlight(text, CLexer() if not python else PythonLexer(),
+                         TerminalFormatter())
 
 
-def get_highlighted_code(text):
-    try:
-        from pygments import highlight
-    except ImportError:
-        return text
-    else:
-        from pygments.lexers import CLexer
-        from pygments.formatters import TerminalFormatter
+def get_highlighted_python_code(text):
+    return get_highlighted_code(text, True)
 
-        return highlight(text, CLexer(), TerminalFormatter())
 
 # }}}