code: def findspans(self, type,set=None):
          
  
          if issubclass(type, AbstractAnnotationLayer):
              layerclass = type
          else:
              layerclass = ANNOTATIONTYPE2LAYERCLASS[type.ANNOTATIONTYPE]
          e = self
          while True:
              if not e.parent: break
              e = e.parent
              for layer in e.select(layerclass,set,False):
                  if type is layerclass:
                      for e2 in layer.select(AbstractSpanAnnotation,set,True, (True, Word, Morpheme)):
                          if not isinstance(e2, AbstractSpanRole) and self in e2.wrefs():
                              yield e2
                  else:
                      for e2 in layer.select(type,set,True, (True, Word, Morpheme)):
                          if not isinstance(e2, AbstractSpanRole) and self in e2.wrefs():
                              yield e2
docs: Yields span annotation elements of the specified type that include this word.
  
          Arguments:
              type: The annotation type, can be passed as using any of the :class:`AnnotationType` member, or by passing the relevant :class:`AbstractSpanAnnotation` or :class:`AbstractAnnotationLayer` class.
              set (str or None): Constrain by set
  
          Example::
  
              for chunk in word.findspans(folia.Chunk):
                  print(" Chunk class=", chunk.cls, " words=")
                  for word2 in chunk.wrefs(): #print all words in the chunk (of which the word is a part)
                      print(word2, end="")
                  print()
  
          Yields:
              Matching span annotation instances (derived from :class:`AbstractSpanAnnotation`)