code: def normalize_newlines(text):
      r"""
      Replace alternate newlines with the canonical newline.
  
      >>> normalize_newlines('Lorem Ipsum\u2029')
      'Lorem Ipsum\n'
      >>> normalize_newlines('Lorem Ipsum\r\n')
      'Lorem Ipsum\n'
      >>> normalize_newlines('Lorem Ipsum\x85')
      'Lorem Ipsum\n'
      """
      newlines = ["\r\n", "\r", "\n", "\u0085", "\u2028", "\u2029"]
      pattern = "|".join(newlines)
      return re.sub(pattern, "\n", text)
  
imports: import re
  import itertools
  import textwrap
  import functools
  from pkg_resources.extern.jaraco.functools import compose, method_cache
  from pkg_resources.extern.jaraco.context import ExceptionTrap
label_desc: Use image node_id 12 for calling a global function with example usage: normalize_newlines(text) and returns: re