code: def put_annotation(self, key, value):
          
          self._check_ended()
  
          if not isinstance(key, string_types):
              log.warning("ignoring non string type annotation key with type %s.", type(key))
              return
  
          if not isinstance(value, annotation_value_types):
              log.warning("ignoring unsupported annotation value type %s.", type(value))
              return
  
          if any(character not in _valid_annotation_key_characters for character in key):
              log.warning("ignoring annnotation with unsupported characters in key: '%s'.", key)
              return
  
          self.annotations[key] = value
docs: Annotate segment or subsegment with a key-value pair.
          Annotations will be indexed for later search query.
  
          :param str key: annotation key
          :param object value: annotation value. Any type other than
              string/number/bool will be dropped