<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_doc_types(cls, exclude_base=False):
 """Returns the doc_type of this class and all of its descendants."""

        names = []
        if not exclude_base and hasattr(cls, 'search_objects'):
            if not getattr(cls.search_objects.mapping, "elastic_abstract", False):
                names.append(cls.search_objects.mapping.doc_type)
        for subclass in cls.__subclasses__():
            names += subclass.get_doc_types()
        return names