def _read_until(sock, char):
 chunks = []
 while True:
  chunk = sock.recv(1)
  chunks.append(chunk)
  if (chunk == char):
   break
 return ''.join(chunks)

def _read_until ( sock , char ) : chunks = [ ] while True : chunk = sock . recv ( 1 ) chunks . append ( chunk ) if ( chunk == char ) : break return '' . join ( chunks )
read from the socket until the character is received .