code: def repeating_chars(text: str, *, chars: str, maxn: int = 1) -> str:
      """
      Normalize repeating characters in ``text`` by truncating their number of consecutive
      repetitions to ``maxn``.
  
      Args:
          text
          chars: One or more characters whose consecutive repetitions are to be normalized,
              e.g. "." or "?!".
          maxn: Maximum number of consecutive repetitions of ``chars`` to which
              longer repetitions will be truncated.
  
      Returns:
          str
      """
      return re.sub(
          r"({}){{{},}}".format(re.escape(chars), maxn + 1),
          chars * maxn,
          text,
      )
  
file_path: textacy/src/textacy/preprocessing/normalize.py
imports: import re
  import unicodedata
  from typing import Literal
  from .None import resources
label_desc: Use image node_id 4 for calling a global function with example usage: repeating_chars(text) and returns: re