example from http://thp.io/2007/python-jabberbot/