We're testing `hasattr(func, 'im_func')`, so we should either use `im_func`, or change the test.

Just checked: in Python 2, both unbound and bound methods have `im_func` (and `__func__`). In Python 3, only bound methods have `__func__`.