def subclasses(cls, abstract=False, private=False):
    """Return the subclasses of class `cls` as a dict.

    If abstract, include classes with abstract methods.
    If private, include private classes.
    """
    return {
        sc.__name__: sc
        for sc in cls.__subclasses__()
        if (abstract or not sc.__abstractmethods__) and (
            private or sc.__name__[0] != '_')
    }