from typing import Iterable
import difflib


def _index_of_ressort(ressort: str, ressorts: Iterable[str]) -> int | None:
    """
    Return the position of the given resort in an iterable of ressorts.
    The check is performed fuzzy to match e.g. ``POLITIK`` and ``Politik``.
    Return the matching index or ``None`` if unable to find a match.
    """

    def ignore_nonalpha(character: str) -> bool:
        return not character.isalpha()

    for index, possible_match in enumerate(ressorts):
        matcher = difflib.SequenceMatcher(ignore_nonalpha, ressort.lower(), possible_match.lower())
        is_match = matcher.ratio() > 0.8
        if is_match:
            return index

    return None