You have this routine _ThreadedTCPServer.get_somaxconn() in agi/fastagi.py which goes to a lot of trouble to figure out the value of the system constant SOMAXCONN.
This is completely unnecessary, since that constant has been in the Python socket module since just about forever—certainly since Python 2.7—in other words, in every version of Python you could conceivably care about. Just use that value.