code: def _soup_strings(soup):
    
    paragraph_tags = set([
        "caption", "details", "h1", "h2", "h3", "h4", "h5", "h6", "li", "p", "td",
        "div", "span"
    ])
  
    skip_children = None
    for descendant in soup.descendants:
      # If we've treated a tag as a contiguous paragraph, don't re-emit the
      # children (see below).
      if skip_children is not None:
        try:
          in_skip = descendant in skip_children  # pylint: disable=unsupported-membership-test
        except RecursionError:  # pylint: disable=undefined-variable
          # Possible for this check to hit a nasty infinite recursion because of
          # BeautifulSoup __eq__ checks.
          in_skip = True
        if in_skip:
          continue
        else:
          skip_children = None
  
      # Treat some tags as contiguous paragraphs, regardless of other tags nested
      # inside (like <a> or <b>).
      if isinstance(descendant, bs4.Tag):
        if descendant.name in paragraph_tags:
          if descendant.find_all(paragraph_tags):
            # If there are nested paragraph tags, don't treat it as a single
            # contiguous tag.
            continue
          skip_children = list(descendant.descendants)
          text = " ".join(descendant.get_text(" ", strip=True).split())
          if text:
            yield text
          continue
  
      if (isinstance(descendant, bs4.Comment) or
          not isinstance(descendant, bs4.NavigableString)):
        continue
  
      text = " ".join(descendant.strip().split())
      if text:
        yield text
docs: Return text strings in soup.