def count_trailing_newlines(s):
    'count number of trailing newlines\n\n    this includes newlines that are separated by other whitespace\n    '
    return s[len(s.rstrip()):].count('\n')
count number of trailing newlines

this includes newlines that are separated by other whitespace
def count_trailing_newlines(s):
    'count number of trailing newlines\n\n    this includes newlines that are separated by other whitespace\n    '
    return s[len(s.rstrip()):].count('\n')