def get_flashed_messages(with_categories=False, category_filter=[]):
 flashes = _request_ctx_stack.top.flashes
 if (flashes is None):
  _request_ctx_stack.top.flashes = flashes = (session.pop('_flashes') if ('_flashes' in session) else [])
 if category_filter:
  flashes = list(filter((lambda f: (f[0] in category_filter)), flashes))
 if (not with_categories):
  return [x[1] for x in flashes]
 return flashes

def get_flashed_messages ( with_categories = False , category_filter = [ ] ) : flashes = _request_ctx_stack . top . flashes if ( flashes is None ) : _request_ctx_stack . top . flashes = flashes = ( session . pop ( '_flashes' ) if ( '_flashes' in session ) else [ ] ) if category_filter : flashes = list ( filter ( ( lambda f : ( f [ 0 ] in category_filter ) ) , flashes ) ) if ( not with_categories ) : return [ x [ 1 ] for x in flashes ] return flashes
pulls all flashed messages from the session and returns them .