Backport of the functools module from Python 3.2.3
