def _realize_padding(it):
 padding = None
 for item in it:
  if isinstance(item, int):
   padding = max(padding, item)
   continue
  if padding:
   (yield ('\n' * padding))
   padding = None
  (yield item)

def _realize_padding ( it ) : padding = None for item in it : if isinstance ( item , int ) : padding = max ( padding , item ) continue if padding : ( yield ( '\n' * padding ) ) padding = None ( yield item )
fold and convert padding requests: integers in the output sequence are requests for at least n newlines of padding .