code: def _generate_union_class_get_helpers(self, ns, data_type):
          
          for field in data_type.fields:
              field_name = fmt_func(field.name)
  
              if not is_void_type(field.data_type):
                  # generate getter for field
                  self.emit('def get_{}(self):'.format(field_name))
                  with self.indent():
                      if is_nullable_type(field.data_type):
                          field_dt = field.data_type.data_type
                      else:
                          field_dt = field.data_type
                      self.emit('"""')
                      if field.doc:
                          self.emit_wrapped_text(
                              self.process_doc(field.doc, self._docf))
                          self.emit()
                      self.emit("Only call this if :meth:`is_%s` is true." %
                                field_name)
                      # Sphinx wants an extra line between the text and the
                      # rtype declaration.
                      self.emit()
                      self.emit(':rtype: {}'.format(
                          self._python_type_mapping(ns, field_dt)))
                      self.emit('"""')
  
                      self.emit('if not self.is_{}():'.format(field_name))
                      with self.indent():
                          self.emit(
                              'raise AttributeError("tag \'{}\' not set")'.format(
                                  field_name))
                      self.emit('return self._value')
                  self.emit()
docs: These are the getters used to access the value of a variant, once
          the tag has been switched on.