code: def filter_paragraphs(paragraphs, contains=None):
      
      if contains is None:
          pattern = ''
      else:
          if isinstance(contains, str):
              contains = [contains]
          pattern = '|'.join(r'[^\w]%s[^\w]' % shortform
                             for shortform in contains)
      paragraphs = [p for p in paragraphs if re.search(pattern, p)]
      return '\n'.join(paragraphs) + '\n'
docs: Filter paragraphs to only those containing one of a list of strings
  
      Parameters
      ----------
      paragraphs : list of str
          List of plaintext paragraphs from an article
  
      contains : str or list of str
          Exclude paragraphs not containing this string as a token, or
          at least one of the strings in contains if it is a list
  
      Returns
      -------
      str
          Plaintext consisting of all input paragraphs containing at least
          one of the supplied tokens.