docs: def strip_accents(x):
      u"""Strip accents in the input phrase X.
  
      Strip accents in the input phrase X (assumed in UTF-8) by replacing
      accented characters with their unaccented cousins (e.g. é by e).
  
      :param x: the input phrase to strip.
      :type x: string
  
      :return: Return such a stripped X.
      """
      x = re_latex_lowercase_a.sub("a", x)
      x = re_latex_lowercase_ae.sub("ae", x)
      x = re_latex_lowercase_oe.sub("oe", x)
      x = re_latex_lowercase_e.sub("e", x)
      x = re_latex_lowercase_i.sub("i", x)
      x = re_latex_lowercase_o.sub("o", x)
      x = re_latex_lowercase_u.sub("u", x)
      x = re_latex_lowercase_y.sub("x", x)
      x = re_latex_lowercase_c.sub("c", x)
      x = re_latex_lowercase_n.sub("n", x)
      x = re_latex_uppercase_a.sub("A", x)
      x = re_latex_uppercase_ae.sub("AE", x)
      x = re_latex_uppercase_oe.sub("OE", x)
      x = re_latex_uppercase_e.sub("E", x)
      x = re_latex_uppercase_i.sub("I", x)
      x = re_latex_uppercase_o.sub("O", x)
      x = re_latex_uppercase_u.sub("U", x)
      x = re_latex_uppercase_y.sub("Y", x)
      x = re_latex_uppercase_c.sub("C", x)
      x = re_latex_uppercase_n.sub("N", x)
  
      # convert input into Unicode string:
      try:
          y = unicode(x, "utf-8")
      except Exception:
          return x  # something went wrong, probably the input wasn't UTF-8
      # asciify Latin-1 lowercase characters:
      y = re_unicode_lowercase_a.sub("a", y)
      y = re_unicode_lowercase_ae.sub("ae", y)
      y = re_unicode_lowercase_oe.sub("oe", y)
      y = re_unicode_lowercase_e.sub("e", y)
      y = re_unicode_lowercase_i.sub("i", y)
      y = re_unicode_lowercase_o.sub("o", y)
      y = re_unicode_lowercase_u.sub("u", y)
      y = re_unicode_lowercase_y.sub("y", y)
      y = re_unicode_lowercase_c.sub("c", y)
      y = re_unicode_lowercase_n.sub("n", y)
      y = re_unicode_lowercase_ss.sub("ss", y)
      # asciify Latin-1 uppercase characters:
      y = re_unicode_uppercase_a.sub("A", y)
      y = re_unicode_uppercase_ae.sub("AE", y)
      y = re_unicode_uppercase_oe.sub("OE", y)
      y = re_unicode_uppercase_e.sub("E", y)
      y = re_unicode_uppercase_i.sub("I", y)
      y = re_unicode_uppercase_o.sub("O", y)
      y = re_unicode_uppercase_u.sub("U", y)
      y = re_unicode_uppercase_y.sub("Y", y)
      y = re_unicode_uppercase_c.sub("C", y)
      y = re_unicode_uppercase_n.sub("N", y)
      # return UTF-8 representation of the Unicode string:
      return y.encode("utf-8")