def strip_newsgroup_footer(text):
 lines = text.strip().split('\n')
 for line_num in range((len(lines) - 1), (-1), (-1)):
  line = lines[line_num]
  if (line.strip().strip('-') == ''):
   break
 if (line_num > 0):
  return '\n'.join(lines[:line_num])
 else:
  return text

def strip_newsgroup_footer ( text ) : lines = text . strip ( ) . split ( '\n' ) for line_num in range ( ( len ( lines ) - 1 ) , ( - 1 ) , ( - 1 ) ) : line = lines [ line_num ] if ( line . strip ( ) . strip ( '-' ) == '' ) : break if ( line_num > 0 ) : return '\n' . join ( lines [ : line_num ] ) else : return text
given text in "news" format .