code: def _generate_legacy_type_checks(types=()):
      
      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
docs: 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`