def strip_encoding_cookie(filelike):
 it = iter(filelike)
 try:
  first = next(it)
  if (not cookie_comment_re.match(first)):
   (yield first)
  second = next(it)
  if (not cookie_comment_re.match(second)):
   (yield second)
 except StopIteration:
  return
 for line in it:
  (yield line)

def strip_encoding_cookie ( filelike ) : it = iter ( filelike ) try : first = next ( it ) if ( not cookie_comment_re . match ( first ) ) : ( yield first ) second = next ( it ) if ( not cookie_comment_re . match ( second ) ) : ( yield second ) except StopIteration : return for line in it : ( yield line )
generator to pull lines from a text-mode file .