def type_named(obj, name):
    """
    Similar to the type() builtin, but looks in class bases
    for named instance.

    Parameters
    ----------
    obj: object to look for class of
    name : str, name of class

    Returns
    ----------
    named class, or None
    """
    # if obj is a member of the named class, return True
    name = str(name)
    if obj.__class__.__name__ == name:
        return obj.__class__
    for base in type_bases(obj):
        if base.__name__ == name:
            return base
    raise ValueError('Unable to extract class of name ' + name)
def type_named ( obj , name ) : name = str ( name ) if obj . __class__ . __name__ == name : return obj . __class__ for base in type_bases ( obj ) : if base . __name__ == name : return base raise ValueError ( 'Unable to extract class of name ' + name )
Similar to the type() builtin, but looks in class bases
    for named instance.

    Parameters
    ----------
    obj: object to look for class of
    name : str, name of class

    Returns
    ----------
    named class, or None