def _check_max_features(importances, max_features):
    """Interpret the max_features value"""

    n_features = len(importances)

    if max_features is None:
        max_features = n_features

    elif isinstance(max_features, int):
        max_features = min(n_features, max_features)

    elif isinstance(max_features, float):
        max_features = int(n_features * max_features)

    return max_features