My lecture Mustafa Başer give me the same homework.But u have to check similar algorithm at c then you can manipulate the same functions for python.Cause other languages (except C#, java etc.) does not have a strong library as python.Or alternatively you can check the source codes too see behind the function's code.
-- http://mail.python.org/mailman/listinfo/python-list