Backport of the functools module from Python 3.2.3 for use on 2.7 and PyPy. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>