def flatten_all_filter(components: dict, filter_obj=None):
    """Internal function to flatten a dict of shapely objects.

    Args:
        components (dict): Dictionary of components
        filter_obj (class): Filter based on this class.  Defaults to None.

    Returns:
        array: Flattened dictionary
    """
    assert isinstance(components, dict)

    RES = []
    for name, obj in components.items():
        if isinstance(obj, dict):
            RES += flatten_all_filter(obj, filter_obj)
        else:
            if filter_obj is None:
                RES += [obj]  # add whatever we have in here
            else:
                if isinstance(obj, filter_obj):
                    RES += [obj]
                else:
                    print('flatten_all_filter: ', name)

    return RES