def _format_json(data, theme):
output = json.dumps(data, indent=<NUM_LIT:2>, sort_keys=True)<EOL>if pygments and sys.stdout.isatty():<EOL><INDENT>style = get_style_by_name(theme)<EOL>formatter = Terminal256Formatter(style=style)<EOL>return pygments.highlight(output, JsonLexer(), formatter)<EOL><DEDENT>return output<EOL>
Pretty print a dict as a JSON, with colors if pygments is present.