code: def _add_example(self, example):
          
          if len(example.fields) != 1:
              raise InvalidSpec(
                  'Example for union must specify exactly one tag.',
                  example.lineno, example.path)
  
          # Extract the only tag in the example.
          example_field = list(example.fields.values())[0]
          tag = example_field.name
  
          # Find the union member that corresponds to the tag.
          for field in self.all_fields:
              if tag == field.name:
                  break
          else:
              # Error: Tag doesn't match any union member.
              raise InvalidSpec(
                  "Unknown tag '%s' in example." % tag,
                  example.lineno, example.path
              )
  
          # TODO: are we always guaranteed at least one field?
          # pylint: disable=undefined-loop-variable
          try:
              field.data_type.check_example(example_field)
          except InvalidSpec as e:
              e.msg = "Bad example for field '{}': {}".format(
                  field.name, e.msg)
              raise
  
          self._raw_examples[example.label] = example
docs: Adds a "raw example" for this type.
  
          This does basic sanity checking to ensure that the example is valid
          (required fields specified, no unknown fields, correct types, ...).
  
          The example is not available via :meth:`get_examples` until
          :meth:`_compute_examples` is called.
  
          Args:
              example (stone.frontend.ast.AstExample): An example of this
                  type.