code: def is_instance_or_subclass(val, class_):
      
      try:
          return issubclass(val, class_)
      except TypeError:
          return isinstance(val, class_)
docs: Return True if ``val`` is either a subclass or instance of ``class_``.