from typing import Callable
from typing import Collection
from typing import Any
import operator


def acc_contains(dep) -> Callable[[Collection, str], Any]:
    """
    A fn like :func:`operator.contains` for any `dep` (with-or-without :term:`accessor`)
    """
    acc = getattr(dep, "_accessor", None)
    return acc.contains if acc else operator.contains