<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_public_attributes(cls, as_list=True):
 """ Return class attributes that are neither private nor magic. :param cls: class :param as_list: [True] set to False to return generator :return: only public attributes of class """

    attrs = (a for a in dir(cls) if not a.startswith('_'))
    if as_list:
        return list(attrs)
    return attrs