def _generate_legacy_type_checks(types=()):
types = dict(types)<EOL>def gen_type_check(pytypes):<EOL><INDENT>pytypes = _utils.flatten(pytypes)<EOL>def type_check(checker, instance):<EOL><INDENT>if isinstance(instance, bool):<EOL><INDENT>if bool not in pytypes:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return isinstance(instance, pytypes)<EOL><DEDENT>return type_check<EOL><DEDENT>definitions = {}<EOL>for typename, pytypes in iteritems(types):<EOL><INDENT>definitions[typename] = gen_type_check(pytypes)<EOL><DEDENT>return definitions<EOL>
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`