code: def strip_newsgroup_footer(text):
      """
      Given text in "news" format, attempt to remove a signature block.
  
      As a rough heuristic, we assume that signatures are set apart by either
      a blank line or a line made of hyphens, and that it is the last such line
      in the file (disregarding blank lines at the end).
  
      Parameters
      ----------
      text : str
          The text from which to remove the signature block.
      """
      lines = text.strip().split("\n")
      for line_num in range(len(lines) - 1, -1, -1):
          line = lines[line_num]
          if line.strip().strip("-") == "":
              break
  
      if line_num > 0:
          return "\n".join(lines[:line_num])
      else:
          return text
  
imports: import codecs
  import logging
  import os
  import pickle
  import re
  import shutil
  import tarfile
  import joblib
  import numpy
  import scipy.sparse
  from ..None import preprocessing
  from ..feature_extraction.text import CountVectorizer
  from ..utils import Bunch, check_random_state
  from ..utils._param_validation import StrOptions, validate_params
  from .None import get_data_home, load_files
  from ._base import RemoteFileMetadata, _convert_data_dataframe, _fetch_remote, _pkl_filepath, load_descr
label_desc: Use image node_id 4 for calling a global function with example usage: strip_newsgroup_footer(text) and returns: str, text