def cls_sets(cls, wanted_cls, registered=True):
    """ Return a list of all `wanted_cls` attributes in this
        class, where `wanted_cls` is the desired attribute type.
    """
    sets = []
    for attr in dir(cls):
        if attr.startswith('_'):
            continue
        val = getattr(cls, attr, None)
        if not isinstance(val, wanted_cls):
            continue
        if (not registered) and getattr(val, '_registered', False):
            continue
        sets.append(val)
    return sets