def METHOD_NAME(sentence, subword_option):
  """Clean and handle BPE or SPM outputs."""
  sentence = sentence.strip()
  # BPE
  if subword_option == "bpe":
    sentence = re.sub("@@ ", "", sentence)
  # SPM
  elif subword_option == "spm":
    sentence = u"".join(sentence.split()).replace(u"\u2581", u" ").lstrip()
  return sentence