code: def _safe_isinstance(
      obj: object, class_or_tuple: Union[type, Tuple[type, ...]]
  ) -> bool:
      """isinstance can fail in rare cases, for example types with no __class__"""
      try:
          return isinstance(obj, class_or_tuple)
      except Exception:
          return False
  
imports: import builtins
  import collections
  import dataclasses
  import inspect
  import os
  import sys
  from array import array
  from collections import Counter, UserDict, UserList, defaultdict, deque
  from dataclasses import dataclass, fields, is_dataclass
  from inspect import isclass
  from itertools import islice
  from types import MappingProxyType
  from typing import TYPE_CHECKING, Any, Callable, DefaultDict, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Union
  from rich.repr import RichReprResult
  from .None import get_console
  from ._loop import loop_last
  from ._pick import pick_bool
  from .abc import RichRenderable
  from .cells import cell_len
  from .highlighter import ReprHighlighter
  from .jupyter import JupyterMixin, JupyterRenderable
  from .measure import Measurement
  from .text import Text
label_desc: Use image node_id 6 for calling a global function with example usage: _safe_isinstance(obj, class_or_tuple) and returns: isinstance, False