'Strip trailing line separators from s, but no other whitespaces'

def _stripLineSep(self, s):

    if (s[(-2):] == '\r\n'):
        return s[:(-2)]
    elif (s[(-1):] == '\n'):
        return s[:(-1)]
    else:
        return s
