def _safe_shutdown_socket(sock, how=socket.SHUT_RDWR):
 try:
  sock.shutdown(how)
 except socket.error as exc:
  if (exc.errno != errno.ENOTCONN):
   raise

def _safe_shutdown_socket ( sock , how = socket . SHUT_RDWR ) : try : sock . shutdown ( how ) except socket . error as exc : if ( exc . errno != errno . ENOTCONN ) : raise
shutdown a socket .