Socket close platform compatibility
On some platforms `os.close` does not work for socket file descriptors. This is most noticeable with Windows.
def create_socket_noncompliant(samplehost, sampleport, samplebuffersize):
    import socket
    socket.socket.settimeout(10.0)
    socket = socket.socket()
    socket.connect((samplehost, sampleport))
    print(socket.recv(samplebuffersize))
    # Noncompliant: socket.shutdown is not called before closing the socket.
    socket.close()
def create_socket_compliant(samplehost, sampleport, samplebuffersize):
    import socket
    socket.socket.settimeout(10.0)
    socket = socket.socket()
    socket.connect((samplehost, sampleport))
    try:
        print(socket.recv(samplebuffersize))
    finally:
        # Compliant: socket.shutdown is called before closing the socket.
        socket.shutdown(socket.SHUT_WR)
        socket.close()