import re


def normalize_newlines(text):
    """Normalizes CRLF and CR newlines to just LF."""
    # text = force_text(text)
    re_newlines = re.compile(r'\r\n|\r')  # Used in normalize_newlines
    return re_newlines.sub('\n', text)