Here's an example for showing syntax-highlighted code (that is in the clipboard):
import ui
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
from pygments.styles import get_style_by_name
import clipboard
# Syntax-highlight code in clipboard:
code = clipboard.get()
html_formatter = HtmlFormatter(style='colorful')
highlighted_code = highlight(code, PythonLexer(), html_formatter)
styles = html_formatter.get_style_defs()
html = '<html><head><style>%s</style></head><body>%s</body></html>' % (styles, highlighted_code)
# Present result in a WebView:
webview = ui.WebView(frame=(0, 0, 500, 500))
webview.scales_page_to_fit = False
webview.load_html(html)
webview.present('sheet')