def _safe_shutdown_socket(sock, how=socket.SHUT_RDWR):
    try:
        sock.shutdown(how)
    except socket.error as exc:
        if exc.errno != errno.ENOTCONN:
            raise
See `theano.tensor.nonzero_values`.
dataset/ETHPy150Open pika/pika/tests/acceptance/forward_server.py/_safe_shutdown_socket--crossover with--dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/var.py/_tensor_py_operators.nonzero_values