code: def _generate_legacy_type_checks(types=()):
      """
      Generate newer-style type checks out of JSON-type-name-to-type mappings.
  
      Arguments:
  
          types (dict):
  
              A mapping of type names to their Python types
  
      Returns:
  
          A dictionary of definitions to pass to `TypeChecker`
      """
      types = dict(types)
  
      def gen_type_check(pytypes):
          pytypes = _utils.flatten(pytypes)
  
          def type_check(checker, instance):
              if isinstance(instance, bool):
                  if bool not in pytypes:
                      return False
              return isinstance(instance, pytypes)
  
          return type_check
  
      definitions = {}
      for typename, pytypes in iteritems(types):
          definitions[typename] = gen_type_check(pytypes)
  
      return definitions
  
imports: from __future__ import division
  from warnings import warn
  import contextlib
  import json
  import numbers
  from six import add_metaclass
  from jsonschema import _legacy_validators, _types, _utils, _validators, exceptions
  from jsonschema.compat import Sequence, int_types, iteritems, lru_cache, str_types, unquote, urldefrag, urljoin, urlopen, urlsplit
  from jsonschema.exceptions import ErrorTree
label_desc: Use image node_id 1 for calling a global function with example usage: _generate_legacy_type_checks(types) and returns: definitions, type_check, isinstance, False