def get_klasses():
    modules = [rest_views, generics, serializers]

    if viewsets is not None:
        modules.append(viewsets)
    klasses = {}

    for module in modules:
        for attr_str in dir(module):
            is_subclass = False
            attr = getattr(module, attr_str)
            try:
                is_subclass = (issubclass(attr, View) or
                               issubclass(attr, BaseSerializer))
            except __HOLE__:
                pass
            if not attr_str.startswith('_') and is_subclass:
                add_to_klasses_if_its_restframework(klasses, attr)
                for klass in attr.mro():
                    add_to_klasses_if_its_restframework(klasses, klass)
    return klasses
dataset/ETHPy150Open vintasoftware/cdrf.co/rest_framework_ccbv/inspector.py/get_klasses