def pretty(self, obj):
obj_id = id(obj)<EOL>cycle = obj_id in self.stack<EOL>self.stack.append(obj_id)<EOL>self.begin_group()<EOL>try:<EOL><INDENT>obj_class = getattr(obj, '<STR_LIT>', None) or type(obj)<EOL>try:<EOL><INDENT>printer = self.singleton_pprinters[obj_id]<EOL><DEDENT>except (TypeError, KeyError):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return printer(obj, self, cycle)<EOL><DEDENT>for cls in _get_mro(obj_class):<EOL><INDENT>if cls in self.type_pprinters:<EOL><INDENT>return self.type_pprinters[cls](obj, self, cycle)<EOL><DEDENT>else:<EOL><INDENT>printer = self._in_deferred_types(cls)<EOL>if printer is not None:<EOL><INDENT>return printer(obj, self, cycle)<EOL><DEDENT>else:<EOL><INDENT>if '<STR_LIT>' in obj_class.__dict__:<EOL><INDENT>meth = obj_class._repr_pretty_<EOL>if callable(meth):<EOL><INDENT>return meth(obj, self, cycle)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return _default_pprint(obj, self, cycle)<EOL><DEDENT>finally:<EOL><INDENT>self.end_group()<EOL>self.stack.pop()<EOL><DEDENT>
Pretty print the given object.