code: def strip_punctuation(data: Union[str, spacy.tokens.doc.Doc]) -> str:
      """
      Removes all punctuation from `data`.
      """
      if isinstance(data, str):
          return data.rstrip(string.punctuation)
      elif isinstance(data, spacy.tokens.doc.Doc):
          while len(data) and data[-1].is_punct:
              data = data[:-1]
      else:
          # Can log a warning here, but it may get noisy.
          pass
      return str(data)
  
file_path: allennlp/allennlp/confidence_checks/task_checklists/utils.py
imports: import string
  from typing import Dict, Callable, List, Union
  import numpy
  import spacy
  from checklist.editor import Editor
label_desc: Use image node_id 3 for calling a global function with example usage: strip_punctuation(data) and returns: str, data