def blankline_separated_blocks(text):
 block = []
 for line in text.splitlines(True):
  block.append(line)
  line = line.strip()
  if ((not line) or (line.startswith('===') and (not line.strip('=')))):
   (yield ''.join(block))
   block = []
 if block:
  (yield ''.join(block))

def blankline_separated_blocks ( text ) : block = [ ] for line in text . splitlines ( True ) : block . append ( line ) line = line . strip ( ) if ( ( not line ) or ( line . startswith ( '===' ) and ( not line . strip ( '=' ) ) ) ) : ( yield '' . join ( block ) ) block = [ ] if block : ( yield '' . join ( block ) )
a bunch of === characters is also considered a blank line .