def _generate_base_namespace_module(self, api, namespace):
self.cur_namespace = namespace<EOL>generate_module_header(self)<EOL>if namespace.doc is not None:<EOL><INDENT>self.emit('<STR_LIT>')<EOL>self.emit_raw(namespace.doc)<EOL>self.emit('<STR_LIT>')<EOL>self.emit()<EOL><DEDENT>self.emit_raw(validators_import)<EOL>self._generate_imports_for_referenced_namespaces(namespace)<EOL>for annotation_type in namespace.annotation_types:<EOL><INDENT>self._generate_annotation_type_class(namespace, annotation_type)<EOL><DEDENT>for data_type in namespace.linearize_data_types():<EOL><INDENT>if isinstance(data_type, Struct):<EOL><INDENT>self._generate_struct_class(namespace, data_type)<EOL><DEDENT>elif isinstance(data_type, Union):<EOL><INDENT>self._generate_union_class(namespace, data_type)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>' % type(data_type))<EOL><DEDENT><DEDENT>for alias in namespace.linearize_aliases():<EOL><INDENT>self._generate_alias_definition(namespace, alias)<EOL><DEDENT>for data_type in namespace.linearize_data_types():<EOL><INDENT>if is_struct_type(data_type):<EOL><INDENT>self._generate_struct_class_reflection_attributes(<EOL>namespace, data_type)<EOL>if data_type.has_enumerated_subtypes():<EOL><INDENT>self._generate_enumerated_subtypes_tag_mapping(<EOL>namespace, data_type)<EOL><DEDENT><DEDENT>elif is_union_type(data_type):<EOL><INDENT>self._generate_union_class_reflection_attributes(<EOL>namespace, data_type)<EOL>self._generate_union_class_symbol_creators(data_type)<EOL><DEDENT><DEDENT>self._generate_routes(api.route_schema, namespace)<EOL>
Creates a module for the namespace. All data types and routes are
        represented as Python classes.