code: def _validate_annotation(self, annotation):
          '''Ensures that the annotation has the right fields.'''
          required_keys = set(self._required_keys)
          keys = set(key for key, val in annotation.items() if val)
          missing_keys = required_keys.difference(keys)
          if missing_keys:
              error = 'Annotation missing required fields: {0}'.format(
                  missing_keys)
              raise AnnotationError(errorf _validate_annotation(self, annotation):
          '''Ensures that the annotation has the right fields.'''
          required_keys = set(self._required_keys)
          keys = set(key for key, val in annotation.items() if val)
          missing_keys = required_keys.difference(keys)
          if missing_keys:
              error = 'Annotation missing required fields: {0}'.format(
                  missing_keys)
              raise AnnotationError(error)
docs: Ensures that the annotation has the right fields.