Return the type of an object. Do some regex to remove the "<class..." bit.

def get_dir(obj, **kwargs):
    """Return the type of an object. Do some regex to remove the "<class..." bit."""
    attrs = list(filter(filter_dunder, dir(obj)))

    if not attrs:
        return "No public attributes."

    s = "Attributes:"
    for attr in attrs:
        s += '\n - {} ({})'.format(attr, extract_type(type(getattr(obj, attr))))

    return s