code: def builtins_isinstance(evaluator, objects, types, arguments):
      bool_results = set()
      for o in objects:
          cls = o.py__class__()
          try:
              mro_func = cls.py__mro__
          except AttributeError:
              # This is temporary. Everything should have a class attribute in
              # Python?! Maybe we'll leave it here, because some numpy objects or
              # whatever might not.
              bool_results = set([True, False])
              break
  
          mro = mro_func()
  
          for cls_or_tup in types:
              if cls_or_tup.is_class():
                  bool_results.add(cls_or_tup in mro)
              elif (
                  cls_or_tup.name.string_name == "tuple"
                  and cls_or_tup.get_root_context()
                  == evaluator.builtins_module
              ):
                  # Check for tuples.
                  classes = ContextSet.from_sets(
                      lazy_context.infer()
                      for lazy_context in cls_or_tup.iterate()
                  )
                  bool_results.add(any(cls in mro for cls in classes))
              else:
                  _, lazy_context = list(arguments.unpack())[1]
                  if isinstance(lazy_context, LazyTreeContext):
                      node = lazy_context.data
                      message = (
                          "TypeError: isinstance() arg 2 must be a "
                          "class, type, or tuple of classes and types, "
                          "not %s." % cls_or_tup
                      )
                      analysis.add(
                          lazy_context._context,
                          "type-error-isinstance",
                          node,
                          message,
                      )
  
      return ContextSet.from_iterable(
          compiled.builtin_from_name(evaluator, force_unicode(str(b)))
          for b in bool_results
      )
  
imports: import parso
  from jedi._compatibility import force_unicode
  from jedi import debug
  from jedi.evaluate.arguments import ValuesArguments, repack_with_argument_clinic
  from jedi.evaluate import analysis
  from jedi.evaluate import compiled
  from jedi.evaluate.context.instance import AbstractInstanceContext, CompiledInstance, BoundMethod, InstanceArguments
  from jedi.evaluate.base_context import ContextualizedNode, NO_CONTEXTS, ContextSet
  from jedi.evaluate.context import ClassContext, ModuleContext, FunctionExecutionContext
  from jedi.evaluate.context import iterable
  from jedi.evaluate.lazy_context import LazyTreeContext
  from jedi.evaluate.syntax_tree import is_string
label_desc: Use image node_id 9 for calling a global function with example usage: builtins_isinstance(evaluator, objects, types, arguments) and returns: ContextSet