'Internal implementation of ``__repr__``.
This is separated out for ease of use by subclasses that wish to
override the default ``__repr__`` while keeping the same basic
formatting.'

def _format_cls_repr(cls, keywords=[]):

    parts = [super(_ModelMeta, cls).__repr__()]
    if (not cls._is_concrete):
        return parts[0]
    def format_inheritance(cls):
        bases = []
        for base in cls.mro()[1:]:
            if (not issubclass(base, Model)):
                continue
            elif (inspect.isabstract(base) or base.__name__.startswith(u'_')):
                break
            bases.append(base.name)
        if bases:
            return u'{0}    ({1})'.format(cls.name, u'    ->    '.join(bases))
        else:
            return cls.name
    try:
        default_keywords = [(u'Name', format_inheritance(cls)), (u'Inputs', cls.inputs), (u'Outputs', cls.outputs)]
        if cls.param_names:
            default_keywords.append((u'Fittable    parameters', cls.param_names))
        for (keyword, value) in (default_keywords + keywords):
            if (value is not None):
                parts.append(u'{0}:    {1}'.format(keyword, value))
        return u'\n'.join(parts)
    except Exception:
        return parts[0]
