2to3: Apply `methodattrs` fixes.

Replaces old style `f.im_func` and `f.im_class` method attributes
with `f.__func__` and `f.__class__`. Closes #3070.
Merge pull request #3099 from charris/2to3-methodattrs

2to3: Apply `methodattrs` fixes.