import re


def _pad_punctuation(text):
  """Adds spaces around punctuation."""
  # Add space around punctuation.
  text = re.sub(r"(\W)", r" \1 ", text)
  # Collapse consecutive whitespace into one space.
  text = re.sub(r"\s+", " ", text)
  return text