orderand then it creates pickle of whatever items it is passed the function does not know or care what the items are notice that we have explicitly set the pickle protocol version to --this is to ensure that both clients and server use the same pickle versioneven if client or server is upgraded to run different version of python if we wanted our protocol to be more future proofwe could version it (just as we do with binary disk formatsthis can be done either at the network level or at the data level at the network level we can version by passing two unsigned integers instead of onethat islength and protocol version number at the data level we could follow the convention that the pickle is always list (or always dictionarywhose first item (or "versionitemhas version number (you will get the chance to version the protocol in the exercises the socketmanager is custom context manager that gives us socket to use--we will review it shortly the socket socket sendall(method sends all the data it is given--making multiple socket socket send(calls behind the scenes if necessary we always send two items of datathe length of the pickle and the pickle itself if the wait_for_reply argument is false we don' wait for reply and return immediately--the context manager will ensure that the socket is closed before the function actually returns after sending the data (and when we want reply)we call the socket socket recv(method to get the reply this method blocks until it receives data for the first call we request four bytes--the size of the integer that holds the size of the reply pickle to follow we use the struct struct to unpack the bytes into the size integer we then create an empty bytearray and try to retrieve the incoming pickle in blocks of up to bytes once we have read in size bytes (or if the data has run out before then)we break out of the loop and unpickle the data using the pickle loads(function (which takes bytes or bytearray object)and return it in this case we know that the data will always be tuple since that is the protocol we have established with the car registration serverbut the handle_request(function does not know or care about what the data is if something goes wrong with the network connectionfor examplethe server isn' running or the connection fails for some reasona socket error exception is raised in such cases the exception is caught and the client program issues an error message and terminates class socketmanagerdef __init__(selfaddress)self address address def __enter__(self)self sock socket socket(socket af_inetsocket sock_streamself sock connect(self address