def __call__(self, obj):
if self.enabled:<EOL><INDENT>obj_id = id(obj)<EOL>try:<EOL><INDENT>obj_class = getattr(obj, '<STR_LIT>', None) or type(obj)<EOL>try:<EOL><INDENT>printer = self.singleton_printers[obj_id]<EOL><DEDENT>except (TypeError, KeyError):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return printer(obj)<EOL><DEDENT>for cls in pretty._get_mro(obj_class):<EOL><INDENT>if cls in self.type_printers:<EOL><INDENT>return self.type_printers[cls](obj)<EOL><DEDENT>else:<EOL><INDENT>printer = self._in_deferred_types(cls)<EOL>if printer is not None:<EOL><INDENT>return printer(obj)<EOL><DEDENT><DEDENT><DEDENT>if hasattr(obj_class, self.print_method):<EOL><INDENT>printer = getattr(obj_class, self.print_method)<EOL>return printer(obj)<EOL><DEDENT>return None<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
Compute the format for an object.