from typing import Any
from typing import Union
from typing import Tuple
from typing import get_origin
from typing import get_args


def is_instance(obj: Any, types: Union[type, Tuple[type]]) -> bool:
    """
    ### a wrapper around isinstance that has support for subscripted Unions
    
    obj: the object to test

    types: a type or a tuple of types
    """    
    if get_origin(types) is Union:
        return is_instance(obj, get_args(types))
    
    return isinstance(obj, types)