I know there are several libraries to connect to XMPP servers, but is there an XMPP server library somewhere written in Python?
It seems like that there is a new project on github:
python-xmpp-server
An XMPP Server written in Python.
Personally I'm modifying it to provide an XMPP interface to the service I'm building, and I found it fairly easy to achieve this by modifying the "chat-server" example. You can write your own handlers for presence notification, roster requests, and other events.