def METHOD_NAME(self, object, stream, indent, allowance, context,
                      level):
    # Code almost equal to _format_dict, see pprint code
    write = stream.write
    write(object.__class__.__name__ + '(')
    object_dict = object._asdict()
    length = len(object_dict)
    if length:
        # We first try to print inline, and if it is too large then we print it on multiple lines
        inline_stream = StringIO()
        self.format_namedtuple_items(
            object_dict.items(),
            inline_stream,
            indent,
            allowance + 1,
            context,
            level,
            inline=True)
        max_width = self._width - indent - allowance
        if len(inline_stream.getvalue()) > max_width:
            self.format_namedtuple_items(
                object_dict.items(),
                stream,
                indent,
                allowance + 1,
                context,
                level,
                inline=False)
        else:
            stream.write(inline_stream.getvalue())
    write(')')