You can see some code here http://pysmpp.sourceforge.net/ but it's not complete... it need much more work.