You are probably looking for Twisted, a whole real-time engine for applications. https://twistedmatrix.com/trac/
If you do microframeworks, Flask (think Sinatra on ruby) also has a real-time module, but it's all barebones really, it might not be what you're looking for:
Cheers.