def basic_process_stub_info(process_layer):
    """Returns a StubInfo processing function that is agnostic towards
    layer indices, which means it should work for most cases.

    For example, a function that determines how many missing 2S layers
    are in a StubInfo would be:

        basic_process_stub_info(lambda expected, hit, ps_2s:
                                not ps_2s and expected and not hit)

    Args:
        process_layer: A function from a single layer's expected bool,
        hit bool, and ps/2s bool (in that order) to a boolean.

    Returns:
        A function that accepts a StubInfo and counts for how many
        layers process_layer returns True.
    """

    return lambda stub_info: sum(map(process_layer,
                                     stub_info.get_expected(),
                                     stub_info.get_hit(),
                                     stub_info.get_ps_2s()))