from typing import Union
from typing import Tuple


def safe_issubclass(cls: type, class_or_tuple: Union[type, Tuple[type, ...]]) -> bool:
    """Safe version of ``issubclass()``.

    Apart from incorrect arguments, ``issubclass(a, b)`` can throw an error
    only if `b` has a ``__subclasscheck__`` method that throws an error.
    Therefore, it is not necessary to use ``safe_issubclass()`` if the class
    is known to not override ``__subclasscheck__``.

    Defaults to False if ``issubclass()`` throws.

    """
    try:
        return issubclass(cls, class_or_tuple)
    except Exception:
        return False