from typing import Any
import typing


def hint_is_specialized(hint: Any, target: Any) -> bool:
    """Checks if a type hint is a specialized version of target.

    E.g., hint_is_specialized(ClassVar[int], ClassVar) is True.

    isinstance will invoke type-checking, which this methods sidesteps.
    Behavior is undefined for simple type hints that don't take a type
    argument, like Any or a bare type.
    """
    return typing.get_origin(hint) is target