def handle_conversation(sock, address):
 try:
  while True:
   handle_request(sock)
 except EOFError:
  print 'Client socket to {} has closed'.format(address)
 except Exception as e:
  print 'Client {} error: {}'.format(address, e)
 finally:
  sock.close()

def handle_conversation ( sock , address ) : try : while True : handle_request ( sock ) except EOFError : print 'Client socket to {} has closed' . format ( address ) except Exception as e : print 'Client {} error: {}' . format ( address , e ) finally : sock . close ( )
converse with a client over sock until they are done talking .