def _generate_union_class(self, ns, data_type):<EOL>
self.emit(self._class_declaration_for_type(ns, data_type))<EOL>with self.indent():<EOL><INDENT>self.emit('<STR_LIT>')<EOL>if data_type.doc:<EOL><INDENT>self.emit_wrapped_text(<EOL>self.process_doc(data_type.doc, self._docf))<EOL>self.emit()<EOL><DEDENT>self.emit_wrapped_text(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>if data_type.has_documented_fields():<EOL><INDENT>self.emit()<EOL><DEDENT>for field in data_type.fields:<EOL><INDENT>if not field.doc:<EOL><INDENT>continue<EOL><DEDENT>if is_void_type(field.data_type):<EOL><INDENT>ivar_doc = '<STR_LIT>'.format(<EOL>fmt_namespaced_var(ns.name, data_type.name, field.name),<EOL>self.process_doc(field.doc, self._docf))<EOL><DEDENT>elif is_user_defined_type(field.data_type):<EOL><INDENT>if data_type.namespace.name != ns.name:<EOL><INDENT>formatted_var = fmt_namespaced_var(ns.name, data_type.name, field.name)<EOL><DEDENT>else:<EOL><INDENT>formatted_var = '<STR_LIT>'.format(data_type.name, fmt_var(field.name))<EOL><DEDENT>ivar_doc = '<STR_LIT>'.format(<EOL>fmt_class(field.data_type.name),<EOL>formatted_var,<EOL>self.process_doc(field.doc, self._docf))<EOL><DEDENT>else:<EOL><INDENT>ivar_doc = '<STR_LIT>'.format(<EOL>self._python_type_mapping(ns, field.data_type),<EOL>fmt_namespaced_var(ns.name, data_type.name, field.name), field.doc)<EOL><DEDENT>self.emit_wrapped_text(ivar_doc, subsequent_prefix='<STR_LIT:U+0020>')<EOL><DEDENT>self.emit('<STR_LIT>')<EOL>self.emit()<EOL>self._generate_union_class_vars(data_type)<EOL>self._generate_union_class_variant_creators(ns, data_type)<EOL>self._generate_union_class_is_set(data_type)<EOL>self._generate_union_class_get_helpers(ns, data_type)<EOL>self._generate_union_class_custom_annotations(ns, data_type)<EOL>self._generate_union_class_repr(data_type)<EOL><DEDENT>self.emit('<STR_LIT>'.format(<EOL>class_name_for_data_type(data_type)<EOL>))<EOL>self.emit()<EOL>
Defines a Python class that represents a union in Stone.