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