def proxy_function(*args, **kwargs): if Compatibility.PY2: bound_method = types.MethodType(unbound_method, Application.active(), Application) else: bound_method = types.MethodType(unbound_method, Application.active()) return bound_method(*args, **kwargs)