Print object on output

def write(self, obj):
        """ Print object on output """
        accept = self.request.headers.get("Accept")
        if "json" in accept:
            if JsonDefaultHandler.__parser is None:
                JsonDefaultHandler.__parser = Parser()
            super(JsonDefaultHandler, self).write(JsonDefaultHandler.__parser.encode(obj))
            return
        # If we are not in json mode
        super(JsonDefaultHandler, self).write(obj)