def pretty(self, obj):
        """Pretty print the given object."""
        obj_id = id(obj)
        cycle = obj_id in self.stack
        self.stack.append(obj_id)
        self.begin_group()
        try:
            obj_class = getattr(obj, '__class__', None) or type(obj)
            # First try to find registered singleton printers for the type.
            try:
                printer = self.singleton_pprinters[obj_id]
            except (__HOLE__, KeyError):
                pass
            else:
                return printer(obj, self, cycle)
            # Next look for type_printers.
            for cls in _get_mro(obj_class):
                if cls in self.type_pprinters:
                    return self.type_pprinters[cls](obj, self, cycle)
                else:
                    printer = self._in_deferred_types(cls)
                    if printer is not None:
                        return printer(obj, self, cycle)
            # Finally look for special method names.
            if hasattr(obj_class, '_repr_pretty_'):
                return obj_class._repr_pretty_(obj, self, cycle)
            return _default_pprint(obj, self, cycle)
        finally:
            self.end_group()
            self.stack.pop()
dataset/ETHPy150Open ipython/ipython-py3k/IPython/lib/pretty.py/RepresentationPrinter.pretty