def _is_generic(cls) -> bool:
    """Return True if cls is a generic type. For example, List or List[int]."""
    if cls.__module__ != "typing":
        if not any(c.__module__ == "typing" for c in cls.mro()):
            return False

    params = getattr(cls, "__parameters__", ())
    if params:
        return True

    return bool(getattr(cls, "__args__", ()))