def METHOD_NAME(cls, flag_attr_name="_flags"):
    """Get class flags from estimator class and all its parent classes.
    Parameters
    ----------
    flag_attr_name : str, optional, default = "_flags"
        name of the flag attribute that is read
    Returns
    -------
    collected_flags : dict
        Dictionary of flag name : flag value pairs. Collected from _flags
        class attribute via nested inheritance. NOT overridden by dynamic
        flags set by set_flags or clone_flags.
    """
    collected_flags = dict()
    # We exclude the last two parent classes: sklearn.base.BaseEstimator and
    # the basic Python object.
    for parent_class in reversed(inspect.getmro(cls)[:-2]):
        if hasattr(parent_class, flag_attr_name):
            # Need the if here because mixins might not have _more_flags
            # but might do redundant work in estimators
            # (i.e. calling more flags on BaseEstimator multiple times)
            more_flags = getattr(parent_class, flag_attr_name)
            collected_flags.update(more_flags)
    return deepcopy(collected_flags)