def get_linesep(line):
    """
    Returns the line separator if it exists, otherwise the empty string."
    """
    n = len(line)
    if n >= 2 and line[-2:] == '\r\n':
        return '\r\n'
    elif n >= 1 and line[-1] == '\n':
        return '\n'
    else:
        return ''