def identifier_appearance_stat_key(appearances: set) -> str:
    """Return the key given the appearances of the span."""
    if {'templates', 'references'} <= appearances:
        return 'in_tag_ref_and_template'
    elif 'templates' in appearances:
        return 'only_in_template'
    elif 'references' in appearances:
        return 'only_in_tag_ref'
    elif 'sections' in appearances:
        return 'only_in_filtered_sections'
    else:
        return 'only_in_raw_text'