def format(self, text):
        formatted = None

        try:
            o = json.loads(text)
            formatted = json.dumps(o, indent=2)
        except (__HOLE__, ValueError):
            formatted = text

        return formatted


# under Python <= 2.7.2 the minidom output is gnarly, should be fixed in 2.7.3+
# http://bugs.python.org/issue4147
dataset/ETHPy150Open chrislongo/HttpShell/httpshell/formatters.py/JsonFormatter.format