The multiprocessing library allows you to implement a pipe data structure using the multiprocessing.Pipe (duplex) function. This returns a pair of objects, (conn1, conn2), which represent the end of the pipe.
The duplex parameter determines whether the pipe for the last case is bidirectional (that is, duplex = True), or unidirectional (that is, duplex = False). conn1 can only be used for receiving messages, and conn2 can only be used for sending messages.
Now, let's see how to exchange objects using pipes.