In Python I have been playing around with server sockets that listen for messages, and client socket connections that send the data to the server.
Am i correct in thinking that the server/client python programs that utilize the socket module span layers 5 (session),6(presentation) and 7(application)? I think of the python code that utilizes sockets as presenting data, managing sessions and creating sockets using transport protocols such as tcp or udp.
Is my understanding/thinking correct?
Thank you.
Yes, that's correct.  
Note that the OSI model is not commonly used in practice.  More typically, you see the Internet Reference model, which compresses the OSI layers 5, 6, and 7 into a single layer called the Application Layer.
Python program sending data via sockets, what OSI layers?