Twisted is a Python
for writing network applications
. The way it works is simple: instead of being a library
which your code
calls, think of your code as the library, called by Twisted.
As a very simple example, there is the QOTD protocol: when a connection is made, send a witty quote back and close the connection. With Twisted, this would be implemented as a class which is passed to the Twisted framework, which then runs this server on a port of your choosing.
Twisted can also be used to write client applications, by using some different classes. In fact, it has classes for plenty of things that you may want to do. It has modules for database access (abstracted, of course, to allow XML files to be used by code that once connected to MySQL or something similar), user authentication, high level things like FTP and HTTP, and pretty much anything you can think of.
Included with Twisted are a web server, an IRC server, a mail server, an object broker, and a host of relatively unimportant servers. All this can be reused from your custom code, so this could come in handy if you ever want to have HTTP and FTP access to your up-to-the-minute shipping orders or something.
The web site is at www.twistedmatrix.com if you want more information. There is a nice amount of documentation on that site, including an automatically generated API reference.