Iterate over an analysis dictionary with selected attributes.

    Args:
        analysis_objects: Analysis objects dictionary.
        selections: Keyword arguments used to select attributes from the analysis dictionary.
    Yields:
        object: Matching analysis object.

def iterate_with_selected_objects(analysis_objects: Mapping[Any, Any], **selections: Mapping[str, Any]) -> Iterator[Tuple[Any, Any]]:
    """ Iterate over an analysis dictionary with selected attributes.

    Args:
        analysis_objects: Analysis objects dictionary.
        selections: Keyword arguments used to select attributes from the analysis dictionary.
    Yields:
        object: Matching analysis object.
    """
    for key_index, obj in analysis_objects.items():
        # If selections is empty, we return every object. If it's not empty, then we only want to return
        # objects which are selected in through the selections.
        selected_obj = not selections or all([getattr(key_index, selector) == selected_value for selector, selected_value in selections.items()])

        if selected_obj:
            yield key_index, obj