def frames_iter(socket):
 while True:
  n = next_frame_size(socket)
  if (n == 0):
   break
  while (n > 0):
   result = read(socket, n)
   n -= len(result)
   (yield result)

def frames_iter ( socket ) : while True : n = next_frame_size ( socket ) if ( n == 0 ) : break while ( n > 0 ) : result = read ( socket , n ) n -= len ( result ) ( yield result )
returns a generator of frames read from socket .