Netcat as a python library
nclib is a python socket library that wants to be your friend.
nclib provides:
Easy-to-use interfaces for connecting to and listening on TCP and UDP sockets
The ability to handle any python stream-like object with a single interface
A better socket class, the Netcat object
Mechanisms to launch processes with their in/out streams connected to sockets
TCP and UDP server classes for writing simple python daemons
A script to easily daemonize command-line programs
If you are familiar with pwntools, nclib provides much of the functionaly that pwntools' socket wrappers do, but with the bonus feature of not being pwntools.
.. code-block:: bash
pip install nclib