def UNIX_text(text):
    """Convert line breaks from DOS/Windows or Macintosh to UNIX convention.
    DOS/Windows: '\n\r', Macinosh: '\r':, UNIX: '\n'"""
    if not "\r" in text: return text # already in UNIX format
    text = text.replace("\n\r","\n") # was DOS to UNIX
    text = text.replace("\r\n","\n") # was ? to UNIX
    text = text.replace("\r","\n") #  MAC to UNIX
    return text