def _has_compatible_type_vars(type_info: TypeInfo) -> bool:
    """
    Determines whether the provided 'type_info',
    is a generically parameterized subclass of models.QuerySet[T], with exactly
    one type variable.

    Criteria for compatibility:
    1. 'type_info' must be a generic class with exactly one type variable.
    2. All superclasses of 'type_info', up to and including models.QuerySet,
       must also be generic classes with exactly one type variable.

    Examples:

    Compatible:
        class _MyModelQuerySet(models.QuerySet[T]): ...
        class MyModelQuerySet(_MyModelQuerySet[T_2]):
            def example(self) -> T_2: ...

    Incompatible:
        class MyModelQuerySet(models.QuerySet[T], Generic[T, T2]):
            def example(self, a: T2) -> T_2: ...

    Returns:
        True if the 'base' meets the criteria, otherwise False.
    """
    args = type_info.defn.type_vars
    if not args or len(args) > 1 or not isinstance(args[0], TypeVarType):
        # No type var to manage, or too many
        return False
    type_var: MypyType | None = None
    # check that for all the bases it has only one type vars
    for sub_base in type_info.bases:
        unic_args = list(set(sub_base.args))
        if not unic_args or len(unic_args) > 1:
            # No type var for the sub_base, skipping
            continue
        if type_var and unic_args and type_var != unic_args[0]:
            # There is two different type vars in the bases, we are not compatible
            return False
        type_var = unic_args[0]
    if not type_var:
        # No type var found in the bases.
        return False

    if type_info.has_base(fullnames.QUERYSET_CLASS_FULLNAME):
        # If it is a subclass of QuerySet, it is compatible.
        return True
    # check that at least one base is a subclass of queryset with Generic type vars
    return any(_has_compatible_type_vars(sub_base.type) for sub_base in type_info.bases)

    Determines whether the provided 'type_info',
    is a generically parameterized subclass of models.QuerySet[T], with exactly
    one type variable.

    Criteria for compatibility:
    1. 'type_info' must be a generic class with exactly one type variable.
    2. All superclasses of 'type_info', up to and including models.QuerySet,
       must also be generic classes with exactly one type variable.

    Examples:

    Compatible:
        class _MyModelQuerySet(models.QuerySet[T]): ...
        class MyModelQuerySet(_MyModelQuerySet[T_2]):
            def example(self) -> T_2: ...

    Incompatible:
        class MyModelQuerySet(models.QuerySet[T], Generic[T, T2]):
            def example(self, a: T2) -> T_2: ...

    Returns:
        True if the 'base' meets the criteria, otherwise False.
    
mypy_django_plugin/transformers/managers.py