def auto_docstring(cls):
    """ generate a docstring for the new class in which the Attrs are documented """
    header = 'Traited class [{}.{}]'.format(cls.__module__, cls.__name__)
    doc = [header, len(header) * '^', '']
    if cls.__doc__ is not None:
        doc.extend([cls.__doc__, ''])
    doc.extend(['Attributes declared', '"""""""""""""""""""', ''])
    for attr_name in cls.declarative_attrs:
        attr = getattr(cls, attr_name)
        doc.append('{} : {}'.format(attr_name, str(attr)))
        for line in attr.doc.splitlines():
            doc.append('    ' + line.lstrip())
        doc.append('')
    if cls.declarative_props:
        doc.extend(['', 'Properties declared', '"""""""""""""""""""', ''])
    for prop_name in cls.declarative_props:
        prop = getattr(cls, prop_name)
        doc.append('  {} : {}'.format(prop_name, str(prop)))
        for line in prop.attr.doc.splitlines():
            doc.append('    ' + line.lstrip())
        if prop.fget.__doc__ is not None:
            for line in prop.fget.__doc__.splitlines():
                doc.append('    ' + line.lstrip())
    doc = '\n'.join(doc)
    return doc
