def wrap_method(cls, name):
    wrapped = getattr(cls, name)

@functools.wraps(wrapped)
def wrapper(self, *args, **kwargs):
    return self._in(wrapped.__get__(self, cls), *args, **kwargs)
return wrapper

def wrap_methods(cls):
    for name in cls.WRAP_ATTRS:
        setattr(cls, name, wrap_method(cls, name))
Programmatically generate methods for a class