def _all_dicts(T):
    """ Return a list of all __dict__ for a type, or object.

    Args:
        T: the type, or object, to determine the __dicts__ for.

    Returns:
        The list of __dict__ references, including those in base classes.
    """
    if not isinstance(T, type):
        T = type(T)
    dicts = []
    def inner(T, dicts):
        if hasattr(T, '__dict__'):
            dicts.append(T.__dict__)
        for c in T.__bases__:
            inner(c, dicts)
    inner(T, dicts)
    return dicts